ref: 5ce504dbacd2d43d84c951bdfc900fcd6f2a8065
parent: 476cb419d37fa81bd100c9446f691ca274bf934f
author: Paul Brossier <piem@piem.org>
date: Tue Oct 30 06:13:46 EDT 2018
[mathutils] increase ln(2) precision in freqtomidi/miditofreq
--- a/src/mathutils.c
+++ b/src/mathutils.c
@@ -522,7 +522,7 @@
if (freq < 2. || freq > 100000.) return 0.; // avoid nans and infs
/* log(freq/A-2)/log(2) */
midi = freq / 6.875;
- midi = LOG (midi) / 0.69314718055995;
+ midi = LOG (midi) / 0.6931471805599453;
midi *= 12;
midi -= 3;
return midi;
@@ -534,7 +534,7 @@
smpl_t freq;
if (midi > 140.) return 0.; // avoid infs
freq = (midi + 3.) / 12.;
- freq = EXP (freq * 0.69314718055995);
+ freq = EXP (freq * 0.6931471805599453);
freq *= 6.875;
return freq;
}