Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to fast-float2 #4052

Merged
merged 1 commit into from
Nov 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ arbitrary = "1"
bitflags = "2.5.0"
clap = "4.5.21"
colored = "2.1.0"
fast-float = "0.2.0"
fast-float2 = "0.2.3"
hashbrown = "0.15.1"
indexmap = { version = "2.6.0", default-features = false }
indoc = "2.0.5"
Expand Down
2 changes: 1 addition & 1 deletion core/engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ num-integer.workspace = true
bitflags.workspace = true
indexmap = { workspace = true, features = ["std"] }
ryu-js.workspace = true
fast-float.workspace = true
fast-float2.workspace = true
once_cell = { workspace = true, features = ["std"] }
tap.workspace = true
sptr.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion core/engine/src/builtins/number/globals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ pub(crate) fn parse_float(
// Prevent fast_float from parsing "inf", "+inf" as Infinity and "-inf" as -Infinity
Ok(JsValue::nan())
} else {
Ok(fast_float::parse_partial::<f64, _>(s).map_or_else(
Ok(fast_float2::parse_partial::<f64, _>(s).map_or_else(
|_| JsValue::nan(),
|(f, len)| {
if len > 0 {
Expand Down
2 changes: 1 addition & 1 deletion core/parser/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ boa_macros.workspace = true
boa_ast.workspace = true
boa_profiler.workspace = true
rustc-hash = { workspace = true, features = ["std"] }
fast-float.workspace = true
fast-float2.workspace = true
num-traits.workspace = true
bitflags.workspace = true
num-bigint.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion core/parser/src/lexer/number.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ impl<R> Tokenizer<R> for NumberLiteral {
// casting precisely to check if the float doesn't lose info on truncation
#[allow(clippy::cast_possible_truncation)]
NumericKind::Rational /* base: 10 */ => {
let val: f64 = fast_float::parse(num_str).expect("Failed to parse float after checks");
let val: f64 = fast_float2::parse(num_str).expect("Failed to parse float after checks");
let int_val = val as i32;

// The truncated float should be identically to the non-truncated float for the conversion to be loss-less,
Expand Down
2 changes: 1 addition & 1 deletion core/string/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ rustc-hash = { workspace = true, features = ["std"] }
sptr.workspace = true
static_assertions.workspace = true
paste.workspace = true
fast-float.workspace = true
fast-float2.workspace = true

[lints]
workspace = true
Expand Down
2 changes: 1 addition & 1 deletion core/string/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ impl JsString {
return value;
}

fast_float::parse(string).unwrap_or(f64::NAN)
fast_float2::parse(string).unwrap_or(f64::NAN)
}

/// Allocates a new [`RawJsString`] with an internal capacity of `str_len` chars.
Expand Down
Loading