double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1e+216) {
tmp = x + ((t - x) * z);
} else {
tmp = x + (y * (z * (tanh((t / y)) - tanh((x / y)))));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y * z) * (tanh((t / y)) - tanh((x / y))))
end function
↓
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-1d+216)) then
tmp = x + ((t - x) * z)
else
tmp = x + (y * (z * (tanh((t / y)) - tanh((x / y)))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
return x + ((y * z) * (Math.tanh((t / y)) - Math.tanh((x / y))));
}
↓
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1e+216) {
tmp = x + ((t - x) * z);
} else {
tmp = x + (y * (z * (Math.tanh((t / y)) - Math.tanh((x / y)))));
}
return tmp;
}
def code(x, y, z, t):
return x + ((y * z) * (math.tanh((t / y)) - math.tanh((x / y))))
↓
def code(x, y, z, t):
tmp = 0
if y <= -1e+216:
tmp = x + ((t - x) * z)
else:
tmp = x + (y * (z * (math.tanh((t / y)) - math.tanh((x / y)))))
return tmp
function code(x, y, z, t)
return Float64(x + Float64(Float64(y * z) * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y)))))
end
↓
function code(x, y, z, t)
tmp = 0.0
if (y <= -1e+216)
tmp = Float64(x + Float64(Float64(t - x) * z));
else
tmp = Float64(x + Float64(y * Float64(z * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y))))));
end
return tmp
end
function tmp = code(x, y, z, t)
tmp = x + ((y * z) * (tanh((t / y)) - tanh((x / y))));
end
↓
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= -1e+216)
tmp = x + ((t - x) * z);
else
tmp = x + (y * (z * (tanh((t / y)) - tanh((x / y)))));
end
tmp_2 = tmp;
end
(fma.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))) x): 0 points increase in error, 0 points decrease in error
(Rewrite<= fma-def_binary64 (+.f64 (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y)))) x)): 1 points increase in error, 0 points decrease in error
(Rewrite<= +-commutative_binary64 (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y)))))): 0 points increase in error, 0 points decrease in error
Taylor expanded in y around inf 3.1
\[\leadsto \color{blue}{\left(t - x\right) \cdot z + x}
\]
(fma.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))) x): 0 points increase in error, 0 points decrease in error
(Rewrite<= fma-def_binary64 (+.f64 (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y)))) x)): 1 points increase in error, 0 points decrease in error
(Rewrite<= +-commutative_binary64 (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y)))))): 0 points increase in error, 0 points decrease in error
herbie shell --seed 2022294
(FPCore (x y z t)
:name "SynthBasics:moogVCF from YampaSynth-0.2"
:precision binary64
:herbie-target
(+ x (* y (* z (- (tanh (/ t y)) (tanh (/ x y))))))
(+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))))