Some minor fixes in siggen and ln to also work with (untested) 32-bit floats

This commit is contained in:
Anne de Jong 2020-03-09 15:49:25 +01:00
parent 09c6b2680b
commit 6acf45a909
2 changed files with 5 additions and 3 deletions

View File

@ -35,6 +35,7 @@
#define d_cos cos
#define d_pow pow
#define d_log10 log10
#define d_ln log
#define d_epsilon (DBL_EPSILON)
#else // LASP_DOUBLE_PRECISION not defined
@ -51,6 +52,7 @@
#define d_cos cosf
#define d_pow powf
#define d_log10 log10f
#define d_ln logf
#define d_epsilon (FLT_EPSILON)
#endif // LASP_DOUBLE_PRECISION

View File

@ -83,7 +83,7 @@ Siggen* Siggen_Noise_create(const d fs, const d level_dB, Sosfilterbank* colorfi
fsTRACE(15);
Siggen* noise = Siggen_create(NOISE, fs, level_dB);
dbgassert(sizeof(noiseSpecific) <= sizeof(noise->private_data),
dbgassert(sizeof(NoiseSpecific) <= sizeof(noise->private_data),
"Allocated memory too small");
NoiseSpecific* wn = (NoiseSpecific*) noise->private_data;
wn->phase = 0;
@ -264,9 +264,9 @@ static void noise_genSignal(Siggen* siggen, NoiseSpecific* wn, vd* samples) {
S = V1 * V1 + V2 * V2;
} while(S >= 1 || S == 0);
X = V1 * sqrt(-2 * d_log(S) / S);
X = V1 * sqrt(-2 * d_ln(S) / S);
} else
X = V2 * sqrt(-2 * d_log(S) / S);
X = V2 * sqrt(-2 * d_ln(S) / S);
phase = 1 - phase;