mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-25 12:04:21 +01:00
It is easy to chalk this fuzzer issue to erratic floating point behaviour, but this is not the case here. Currently, `exec_math_log` calculates log with arbitrary bases by using the following formula: `log_a(b) ~= ln(b) / ln(a)`. This calculation is an approximation with lots of its floating point precision lost to dividing the results of natural logarithms. By using the specialized versions of the log functions (`log2` & `log10`), we can avoid this loss of precision. SQLite also uses these specialized log functions when possible, so it doesn't hurt to do the same thing when aiming for parity.