var x = (4 * y) + "px";
floating-point constant
float-to-string conversion
floating-point multiplication
string concatenation
0.3
0
sign
exponent
mantissa
(-1)^s * (1.mantissa)2 * 2^(exponent - bias)
01101
0011001101
0.300048828125
exactly
0
sign
exponent
mantissa
01101
0011001101
0.300048828125
exactly
0.2999267578125
0.3001708984375
0.3
0.300048828125
0.3?
Information preservation: a correct parser must return the original floating point value from the output.
Minimum-length output: the output string must be as short as possible.
Most libc and stdlib
SUPER FAST
Stephan T. Lavavej, “Floating-Point <charconv>: Making Your Code 10x Faster With C++17's Final Boss”
Ulf Adams, "Ryū: Fast Float-to-String Conversion"
C to Erlang is not obvious and not pretty
Hopefully the BIF version will help clean this up
Special case for (small) integers
Tests tests tests
The erlang version was old and probably written at the same time as the tests
The tests did not fail properly in case of failure, the failure was swallowed
Saved by compiler test suite....
Hopefully better now, we added a lot of tests
OTP build and tests systems are really really not user friendly
3000488281250.
2999267578125.
3001708984375.
3000488281250
2999267578125
3001708984375
300
299
300
0.3