LSL-PyOptimizer/unit_tests/expr.suite/dumplist2string.out
Sei Lisa d2e64e25a6 Rewrite Mono float to string conversion; fix llDumpList2String
llDumpList2String has changed its behaviour with respect to minus zero. Now it converts -0.0 to a string without the minus sign.

While testing this, we noticed several mismatches in the float to string conversions; the existing routine did not properly convert some values because as we discovered later, it is subject to double rounding; one of them is the built-in round-to-nearest-or-even while getting the first 7 significant digits, and the other is just an increment when the digit is a 5 or more, so round to nearest, ties away from zero, and is performed on the digit past the five or six visible digits that LSL shows.

The new code is a tad easier to understand and more robust.

A first variant of the new code is left commented out for history's sake, and will be removed in the next commit.
2022-05-17 22:28:49 +02:00

37 lines
No EOL
1.1 KiB
Text

[ "String cast in various ways except DumpList2String"
, "<-0.00000, 0.00000, 0.00000>"
, "<-0.000000, 0.000000, 0.000000>"
, "-0.000000"
, "<0.000000, 0.000000, 0.000000>"
, "<0.00000, 0.00000, 0.00000>"
, "0.000000"
, "<0.000002, 0.000000, 0.000000>"
, "<0.00000, 0.00000, 0.00000>"
, "0.000002"
, "<0.000003, 0.000000, 0.000000>"
, "<0.00000, 0.00000, 0.00000>"
, "0.000003"
, "0.000003"
, "<100000000000.000000, 0.000000, 0.000000>"
, "<100000000000.00000, 0.00000, 0.00000>"
, "100000000000.000000"
, "100000000000.000000"
, "<-0.000000, 0.000000, 0.000000>"
, "<100000000000.000000, 0.000000, 0.000000>"
, "<-0.000000, 0.000000, 0.000000>"
, "<99999997952.000000, 0.000000, 0.000000>"
, "DumpList2String:"
, "<0.000000, 0.000000, 0.000000, 0.000000>"
, "<0.000000, 0.000000, 0.000000, 0.000000>"
, "0.000000"
, "<0.000001, 0.000000, 0.000000>"
, "<-0.000001, 0.000000, 0.000000>"
, "<0.000000, 0.000000, 0.000000>"
, "<0.000000, 0.000000, 0.000000>"
, "<0.000002, 0.000000, 0.000000>"
, "<-0.000002, 0.000000, 0.000000>"
, "<0.000003, 0.000000, 0.000000>"
, "<-0.000003, 0.000000, 0.000000>"
, "100000000000.000000"
, "------"
]