var x = (4 * y) + "px";
floating-point constant
float-to-string conversion
floating-point multiplication
string concatenation
var x = (4 * y) + "px";
floating-point constant
float-to-string conversion
floating-point multiplication
string concatenation
var x = (4 * y) + "px";
floating-point constant
float-to-string conversion
floating-point multiplication
string concatenation
Unknown but used
Dragon4 (Steele and White, 1990)
Improved by Gay (1990), Burger and Dybvig(1996)
Grisu family (Loitsch, 2010)
Errol3 (Andrysco, Jhala, and Lerner, 2016)
Ryu (Ulf Adams, 2018)
Schubfach and Dragonbox (2017 to 2021)
Multiple formats use strings to represent floats
SVG
CSV
JSON
There are more and more use for these
Graphs in liveview
Monitoring use a lot of floats
IoT
ML/Data Science
CPU bottleneck !
not network, disk or memory
0.3
0
01101
0011001101
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.
Unknown but used
Dragon4 (Steele and White, 1990)
Improved by Gay (1990), Burger and Dybvig(1996)
Grisu family (Loitsch, 2010)
Errol3 (Andrysco, Jhala, and Lerner, 2016)
Ryu (Ulf Adams, 2018)
Schubfach and Dragonbox (2017 to 2021)
Most libc and stdlib
SUPER FAST
Look for it and the pretty option
Even faster ? Maybe but no real interest for me or OTP right now
Would need to replace printf, but maintainance.
Dragonbox....
Noone want to work on libc
Would need to replace printf, but maintainance.
Dragonbox....
Noone want to work on libc
String to float maybe....
There is lot of dragon area in the BEAM
There are totally something you can go in and help !
That would help everyone
We need funding to help these
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