Skip to content

Commit

Permalink
make sure -0 is printed out for float32
Browse files Browse the repository at this point in the history
  • Loading branch information
lastmjs committed Dec 12, 2023
1 parent d2c032e commit f785c02
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions property_tests/arbitraries/candid/to_src_literal/float.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ export function floatToSrcLiteral(value: number): string {
return 'Number.NaN';
}
if (Number.isFinite(value)) {
if (1 / value === -Infinity) {
return '-0';
}

return value.toString();
}
if (value > 0) {
Expand Down

0 comments on commit f785c02

Please sign in to comment.