3 ms·
It would be nice to have a different color for languages that give the exact IEEE 754 result. Other languages can be using some kind of fast math. Sorted by acc
by gus_massa 11mo ago
It would be nice to have a different color for languages that give the exact IEEE 754 result. Other languages can be using some kind of fast math. Sorted by accuracy:
# Language Accuracy
14 Swift (SIMD) 8.69
9 Fortran 90 9.44
2 C# (SIMD) 9.49
. [All the others] 9.50
- pklausler 11mo agoIs "accuracy" defined anywhere on that page?
- gus_massa 11mo agoFrom https://github.com/niklas-heer/speed-comparison/blob/master/dagger-poc/scmeta.py https://github.com/niklas-heer/speed-comparison/blob/master/... // [I removed the error checking] def pi_accuracy(value_str): """Calculate accuracy of computed pi value. Returns the number of correct decimal places (higher is better). """ value = float(value_str) # math.pi is available in MicroPython accuracy = 1 - (value / math.pi) return -math.log10(abs(accuracy))