Summary
log (natural) is the only logarithm exposed. Audio/DSP code needs the other two bases constantly — MIDI math is base-2 (midi = 69 + 12*log2(f/440)), decibel math is base-10 (db = 20*log10(v)) — and every consumer writes the same one-liners.
The DeslanStudios port defines _log2 in src/tools/pitch.eigs and inlines (log of x) / (log of 10) in the mixer's meter readouts (mixt_get_peak_db / mixt_get_rms_db); any emulator, SAT-solver bit-math, or entropy code wants log2 too.
What to add
Pure EigenScript, in lib/math.eigs (same shape as #193's find_index):
define log2(x) as:
return (log of x) / 0.6931471805599453
define log10(x) as:
return (log of x) / 2.302585092994046
(Or divide by log of 2 / log of 10 if constants are unwanted.) Domain behavior comes free from log's documented input floor at 1e-10 — no new edge cases.
Definition of done
log2 / log10 in lib/math.eigs with signature comments.
- Assertions:
log2 of 8 == 3, log2 of 1 == 0, log10 of 1000 == 3, round-trip with pow.
- Rows in the lib/math.eigs table in docs/STDLIB.md.
Environment
- EigenScript 0.29.0, HEAD
82ab2ae.
Summary
log(natural) is the only logarithm exposed. Audio/DSP code needs the other two bases constantly — MIDI math is base-2 (midi = 69 + 12*log2(f/440)), decibel math is base-10 (db = 20*log10(v)) — and every consumer writes the same one-liners.The DeslanStudios port defines
_log2insrc/tools/pitch.eigsand inlines(log of x) / (log of 10)in the mixer's meter readouts (mixt_get_peak_db/mixt_get_rms_db); any emulator, SAT-solver bit-math, or entropy code wantslog2too.What to add
Pure EigenScript, in lib/math.eigs (same shape as #193's
find_index):(Or divide by
log of 2/log of 10if constants are unwanted.) Domain behavior comes free fromlog's documented input floor at 1e-10 — no new edge cases.Definition of done
log2/log10in lib/math.eigs with signature comments.log2 of 8 == 3,log2 of 1 == 0,log10 of 1000 == 3, round-trip withpow.Environment
82ab2ae.