mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 17:33:38 +00:00
runtime/mercury_float.c:
Fix a bug in MR_sprintf_float where it would convert 1.8e-10
into "1.80000000000000e-1" instead of "1.8e-10".
The problem was that it was stripping the zeros off the end of the string
produced by sprintf without considering the case where the output
was in scientific notation.
The fix is to remove the `#' from the sprintf format string and then to
append ".0" to the string if there is no "." or "e".
tests/general/float_roundtrip.m:
tests/general/float_roundtrip.exp:
Add regression test.
tests/hard_coded/deep_copy.exp:
tests/hard_coded/expand.exp:
tests/hard_coded/float_reg.exp:
tests/hard_coded/write.exp:
tests/hard_coded/write_binary.exp:
tests/hard_coded/write_reg1.exp:
tests/hard_coded/write_xml.exp:
Update the expected output of these tests as trailing zeros are now
also removed from the base part of scientific notation float strings.
4 lines
29 B
Plaintext
4 lines
29 B
Plaintext
2.88e+32
|
|
1e+32
|
|
10000000000.0
|