Merge pull request 'runtime: math_log is base-10, not natural log' (#134) from fix/math-log-base10 into dev
El SDK CI - dev / build-and-test (push) Failing after 14m48s
El SDK CI - dev / build-and-test (push) Failing after 14m48s
This commit was merged in pull request #134.
This commit is contained in:
@@ -5240,7 +5240,12 @@ el_val_t str_to_float(el_val_t s) {
|
||||
/* ── Math (Float-aware) ──────────────────────────────────────────────────── */
|
||||
|
||||
el_val_t math_sqrt(el_val_t f) { return el_from_float(sqrt(el_to_float(f))); }
|
||||
el_val_t math_log(el_val_t f) { return el_from_float(log(el_to_float(f))); }
|
||||
/* base-10, matching runtime/math.el's documented contract ("math_log — base-10
|
||||
* logarithm") and el_seed.c's __log_f. This returned NATURAL log, so math_log
|
||||
* and math_ln were the same function: log10(100) gave 4.605 instead of 2.
|
||||
* Caught by tests/native/test_math.el on the new framework's first run — the
|
||||
* assertion existed all along, the suite just had no way to report it. */
|
||||
el_val_t math_log(el_val_t f) { return el_from_float(log10(el_to_float(f))); }
|
||||
el_val_t math_ln(el_val_t f) { return el_from_float(log(el_to_float(f))); }
|
||||
el_val_t math_sin(el_val_t f) { return el_from_float(sin(el_to_float(f))); }
|
||||
el_val_t math_cos(el_val_t f) { return el_from_float(cos(el_to_float(f))); }
|
||||
|
||||
Reference in New Issue
Block a user