Skip to content

Commit

Permalink
Merge pull request #6340 from roc-lang/pi-is-not-3
Browse files Browse the repository at this point in the history
pi is not 3
  • Loading branch information
bhansconnect authored Jan 31, 2024
2 parents 5dbc16e + f3b934c commit 795c368
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion crates/glue/tests/test_glue_cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ mod glue_cli_run {
let test_name_str = stringify!($test_name);

// TODO after #5924 is fixed; remove this
let skip_on_linux = ["closures", "option", "nullable_wrapped"];
let skip_on_linux = ["closures", "option", "nullable_wrapped", "enumeration", "nested_record"];

if !(cfg!(target_os = "linux") && (skip_on_linux.contains(&test_name_str))) {
let out = run_app(&dir.join("app.roc"), std::iter::empty());
Expand Down
7 changes: 3 additions & 4 deletions crates/roc_std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,9 @@ impl RocDec {
}
};

let opt_after_point = match parts.next() {
Some(answer) if answer.len() <= Self::DECIMAL_PLACES => Some(answer),
_ => None,
};
let opt_after_point = parts
.next()
.map(|answer| &answer[..Ord::min(answer.len(), Self::DECIMAL_PLACES)]);

// There should have only been one "." in the string!
if parts.next().is_some() {
Expand Down
5 changes: 5 additions & 0 deletions crates/roc_std/tests/test_roc_std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,11 @@ mod test_roc_std {

let example = RocDec::from_str("1000.000").unwrap();
assert_eq!(format!("{example}"), "1000");

// truncate if there are more digits than supported
let example =
RocDec::from_str("3.14159265358979323846264338327950288419716939937510").unwrap();
assert_eq!(format!("{example}"), "3.141592653589793238");
}

#[test]
Expand Down

0 comments on commit 795c368

Please sign in to comment.