revert float formatting change
this change does fix more number tests, but i'm not certain that it doesn't break cases we don't test for. it only solves extremely niche edge cases, so for now reverting until we can be more certain in a later release
This commit is contained in:
parent
1e440a0d2c
commit
942bb20d75
@ -590,23 +590,11 @@ impl<'a> Serializer<'a> {
|
||||
.trim_end_matches('.'),
|
||||
);
|
||||
} else {
|
||||
let p = 10.0_f64.powi(10);
|
||||
|
||||
let n = (num * p).round() / p;
|
||||
|
||||
let formatted = n.to_string();
|
||||
|
||||
if formatted.ends_with(".0") {
|
||||
buffer.push_str(formatted.trim_end_matches('0').trim_end_matches('.'));
|
||||
} else if n.is_infinite() {
|
||||
buffer.push_str(
|
||||
format!("{:.10}", num)
|
||||
.trim_end_matches('0')
|
||||
.trim_end_matches('.'),
|
||||
);
|
||||
} else {
|
||||
buffer.push_str(&formatted);
|
||||
}
|
||||
}
|
||||
|
||||
if buffer.is_empty() || buffer == "-" || buffer == "-0" {
|
||||
|
@ -147,7 +147,7 @@ test!(
|
||||
grass::Options::default().style(grass::OutputStyle::Compressed)
|
||||
);
|
||||
test!(
|
||||
calc,
|
||||
retains_space_between_calc_operations,
|
||||
"a {\n width: calc(100% + 32px);\n}\n",
|
||||
"a{width:calc(100% + 32px)}",
|
||||
grass::Options::default().style(grass::OutputStyle::Compressed)
|
||||
|
@ -205,6 +205,7 @@ test!(
|
||||
"a {\n color: 0;\n color: true;\n}\n"
|
||||
);
|
||||
test!(
|
||||
#[ignore = "float formatting isn't feature complete"]
|
||||
scientific_notation_very_large_positive,
|
||||
"a {\n color: 1e100;\n}\n", "a {\n color: 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000;\n}\n"
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user