
(FPCore (x y z t) :precision binary64 (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))))
double code(double x, double y, double z, double t) {
return x + ((y * z) * (tanh((t / y)) - tanh((x / y))));
}
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
public static double code(double x, double y, double z, double t) {
return x + ((y * z) * (Math.tanh((t / y)) - Math.tanh((x / y))));
}
def code(x, y, z, t): return x + ((y * z) * (math.tanh((t / y)) - math.tanh((x / y))))
function code(x, y, z, t) return Float64(x + Float64(Float64(y * z) * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y))))) end
function tmp = code(x, y, z, t) tmp = x + ((y * z) * (tanh((t / y)) - tanh((x / y)))); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y * z), $MachinePrecision] * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))))
double code(double x, double y, double z, double t) {
return x + ((y * z) * (tanh((t / y)) - tanh((x / y))));
}
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
public static double code(double x, double y, double z, double t) {
return x + ((y * z) * (Math.tanh((t / y)) - Math.tanh((x / y))));
}
def code(x, y, z, t): return x + ((y * z) * (math.tanh((t / y)) - math.tanh((x / y))))
function code(x, y, z, t) return Float64(x + Float64(Float64(y * z) * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y))))) end
function tmp = code(x, y, z, t) tmp = x + ((y * z) * (tanh((t / y)) - tanh((x / y)))); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y * z), $MachinePrecision] * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)
\end{array}
NOTE: y should be positive before calling this function
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (tanh (/ t y))))
(if (<= y 1.05e+162)
(+ x (* y (* z (- t_1 (tanh (/ x y))))))
(+ x (* z (- (* y t_1) x))))))y = abs(y);
double code(double x, double y, double z, double t) {
double t_1 = tanh((t / y));
double tmp;
if (y <= 1.05e+162) {
tmp = x + (y * (z * (t_1 - tanh((x / y)))));
} else {
tmp = x + (z * ((y * t_1) - x));
}
return tmp;
}
NOTE: y should be positive before calling this 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) :: t_1
real(8) :: tmp
t_1 = tanh((t / y))
if (y <= 1.05d+162) then
tmp = x + (y * (z * (t_1 - tanh((x / y)))))
else
tmp = x + (z * ((y * t_1) - x))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z, double t) {
double t_1 = Math.tanh((t / y));
double tmp;
if (y <= 1.05e+162) {
tmp = x + (y * (z * (t_1 - Math.tanh((x / y)))));
} else {
tmp = x + (z * ((y * t_1) - x));
}
return tmp;
}
y = abs(y) def code(x, y, z, t): t_1 = math.tanh((t / y)) tmp = 0 if y <= 1.05e+162: tmp = x + (y * (z * (t_1 - math.tanh((x / y))))) else: tmp = x + (z * ((y * t_1) - x)) return tmp
y = abs(y) function code(x, y, z, t) t_1 = tanh(Float64(t / y)) tmp = 0.0 if (y <= 1.05e+162) tmp = Float64(x + Float64(y * Float64(z * Float64(t_1 - tanh(Float64(x / y)))))); else tmp = Float64(x + Float64(z * Float64(Float64(y * t_1) - x))); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z, t) t_1 = tanh((t / y)); tmp = 0.0; if (y <= 1.05e+162) tmp = x + (y * (z * (t_1 - tanh((x / y))))); else tmp = x + (z * ((y * t_1) - x)); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 1.05e+162], N[(x + N[(y * N[(z * N[(t$95$1 - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(N[(y * t$95$1), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
t_1 := \tanh \left(\frac{t}{y}\right)\\
\mathbf{if}\;y \leq 1.05 \cdot 10^{+162}:\\
\;\;\;\;x + y \cdot \left(z \cdot \left(t_1 - \tanh \left(\frac{x}{y}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(y \cdot t_1 - x\right)\\
\end{array}
\end{array}
if y < 1.05e162Initial program 93.8%
associate-*l*97.1%
Simplified97.1%
if 1.05e162 < y Initial program 79.5%
associate-*l*88.6%
Simplified88.6%
Taylor expanded in x around 0 66.5%
mul-1-neg66.5%
unsub-neg66.5%
Simplified69.5%
Taylor expanded in z around 0 66.5%
*-commutative66.5%
Simplified98.0%
Final simplification97.2%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (fma z (* y (- (tanh (/ t y)) (tanh (/ x y)))) x))
y = abs(y);
double code(double x, double y, double z, double t) {
return fma(z, (y * (tanh((t / y)) - tanh((x / y)))), x);
}
y = abs(y) function code(x, y, z, t) return fma(z, Float64(y * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y)))), x) end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := N[(z * N[(y * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
y = |y|\\
\\
\mathsf{fma}\left(z, y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), x\right)
\end{array}
Initial program 92.0%
+-commutative92.0%
*-commutative92.0%
associate-*l*97.2%
fma-def97.2%
Simplified97.2%
Final simplification97.2%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (let* ((t_1 (tanh (/ t y)))) (if (<= y 7.5e+51) (+ x (* t_1 (* z y))) (+ x (* z (- (* y t_1) x))))))
y = abs(y);
double code(double x, double y, double z, double t) {
double t_1 = tanh((t / y));
double tmp;
if (y <= 7.5e+51) {
tmp = x + (t_1 * (z * y));
} else {
tmp = x + (z * ((y * t_1) - x));
}
return tmp;
}
NOTE: y should be positive before calling this 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) :: t_1
real(8) :: tmp
t_1 = tanh((t / y))
if (y <= 7.5d+51) then
tmp = x + (t_1 * (z * y))
else
tmp = x + (z * ((y * t_1) - x))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z, double t) {
double t_1 = Math.tanh((t / y));
double tmp;
if (y <= 7.5e+51) {
tmp = x + (t_1 * (z * y));
} else {
tmp = x + (z * ((y * t_1) - x));
}
return tmp;
}
y = abs(y) def code(x, y, z, t): t_1 = math.tanh((t / y)) tmp = 0 if y <= 7.5e+51: tmp = x + (t_1 * (z * y)) else: tmp = x + (z * ((y * t_1) - x)) return tmp
y = abs(y) function code(x, y, z, t) t_1 = tanh(Float64(t / y)) tmp = 0.0 if (y <= 7.5e+51) tmp = Float64(x + Float64(t_1 * Float64(z * y))); else tmp = Float64(x + Float64(z * Float64(Float64(y * t_1) - x))); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z, t) t_1 = tanh((t / y)); tmp = 0.0; if (y <= 7.5e+51) tmp = x + (t_1 * (z * y)); else tmp = x + (z * ((y * t_1) - x)); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 7.5e+51], N[(x + N[(t$95$1 * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(N[(y * t$95$1), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
t_1 := \tanh \left(\frac{t}{y}\right)\\
\mathbf{if}\;y \leq 7.5 \cdot 10^{+51}:\\
\;\;\;\;x + t_1 \cdot \left(z \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(y \cdot t_1 - x\right)\\
\end{array}
\end{array}
if y < 7.4999999999999999e51Initial program 93.4%
associate-*l*96.7%
Simplified96.7%
Taylor expanded in x around 0 23.9%
*-commutative23.9%
associate-*r*23.8%
associate-/r*23.8%
rec-exp23.8%
div-sub23.8%
rec-exp23.8%
Simplified77.8%
if 7.4999999999999999e51 < y Initial program 87.2%
associate-*l*93.7%
Simplified93.7%
Taylor expanded in x around 0 48.6%
mul-1-neg48.6%
unsub-neg48.6%
Simplified73.4%
Taylor expanded in z around 0 48.6%
*-commutative48.6%
Simplified92.3%
Final simplification81.1%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 5.2e+149) (+ x (* (tanh (/ t y)) (* z y))) (+ x (* z (- t x)))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 5.2e+149) {
tmp = x + (tanh((t / y)) * (z * y));
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
NOTE: y should be positive before calling this 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 <= 5.2d+149) then
tmp = x + (tanh((t / y)) * (z * y))
else
tmp = x + (z * (t - x))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 5.2e+149) {
tmp = x + (Math.tanh((t / y)) * (z * y));
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 5.2e+149: tmp = x + (math.tanh((t / y)) * (z * y)) else: tmp = x + (z * (t - x)) return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 5.2e+149) tmp = Float64(x + Float64(tanh(Float64(t / y)) * Float64(z * y))); else tmp = Float64(x + Float64(z * Float64(t - x))); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 5.2e+149) tmp = x + (tanh((t / y)) * (z * y)); else tmp = x + (z * (t - x)); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[LessEqual[y, 5.2e+149], N[(x + N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.2 \cdot 10^{+149}:\\
\;\;\;\;x + \tanh \left(\frac{t}{y}\right) \cdot \left(z \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 5.19999999999999957e149Initial program 93.7%
associate-*l*97.1%
Simplified97.1%
Taylor expanded in x around 0 23.7%
*-commutative23.7%
associate-*r*23.5%
associate-/r*23.5%
rec-exp23.5%
div-sub23.5%
rec-exp23.5%
Simplified77.8%
if 5.19999999999999957e149 < y Initial program 80.7%
+-commutative80.7%
*-commutative80.7%
associate-*l*92.2%
fma-def92.2%
Simplified92.2%
Taylor expanded in y around inf 97.3%
Final simplification80.3%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 1.35e-9) x (if (or (<= y 8.8e+206) (not (<= y 4e+289))) (+ x (* z t)) (- x (* z x)))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.35e-9) {
tmp = x;
} else if ((y <= 8.8e+206) || !(y <= 4e+289)) {
tmp = x + (z * t);
} else {
tmp = x - (z * x);
}
return tmp;
}
NOTE: y should be positive before calling this 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 <= 1.35d-9) then
tmp = x
else if ((y <= 8.8d+206) .or. (.not. (y <= 4d+289))) then
tmp = x + (z * t)
else
tmp = x - (z * x)
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.35e-9) {
tmp = x;
} else if ((y <= 8.8e+206) || !(y <= 4e+289)) {
tmp = x + (z * t);
} else {
tmp = x - (z * x);
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 1.35e-9: tmp = x elif (y <= 8.8e+206) or not (y <= 4e+289): tmp = x + (z * t) else: tmp = x - (z * x) return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 1.35e-9) tmp = x; elseif ((y <= 8.8e+206) || !(y <= 4e+289)) tmp = Float64(x + Float64(z * t)); else tmp = Float64(x - Float64(z * x)); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 1.35e-9) tmp = x; elseif ((y <= 8.8e+206) || ~((y <= 4e+289))) tmp = x + (z * t); else tmp = x - (z * x); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[LessEqual[y, 1.35e-9], x, If[Or[LessEqual[y, 8.8e+206], N[Not[LessEqual[y, 4e+289]], $MachinePrecision]], N[(x + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(x - N[(z * x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.35 \cdot 10^{-9}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 8.8 \cdot 10^{+206} \lor \neg \left(y \leq 4 \cdot 10^{+289}\right):\\
\;\;\;\;x + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot x\\
\end{array}
\end{array}
if y < 1.3500000000000001e-9Initial program 93.0%
associate-*l*96.6%
Simplified96.6%
Taylor expanded in x around inf 62.9%
if 1.3500000000000001e-9 < y < 8.80000000000000006e206 or 4.0000000000000002e289 < y Initial program 96.9%
associate-*l*96.7%
Simplified96.7%
Taylor expanded in x around 0 25.7%
*-commutative25.7%
associate-*r*25.4%
associate-/r*25.4%
rec-exp25.4%
div-sub25.4%
rec-exp25.4%
Simplified82.3%
Taylor expanded in y around inf 66.3%
if 8.80000000000000006e206 < y < 4.0000000000000002e289Initial program 68.2%
associate-*l*89.1%
Simplified89.1%
Taylor expanded in x around 0 77.9%
mul-1-neg77.9%
unsub-neg77.9%
Simplified56.6%
Taylor expanded in z around 0 77.9%
*-commutative77.9%
Simplified100.0%
Taylor expanded in x around inf 78.0%
distribute-rgt1-in78.0%
associate-*r*78.0%
mul-1-neg78.0%
unsub-neg78.0%
Simplified78.0%
Final simplification64.7%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 1.25e+51) x (+ x (* z (- t x)))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.25e+51) {
tmp = x;
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
NOTE: y should be positive before calling this 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 <= 1.25d+51) then
tmp = x
else
tmp = x + (z * (t - x))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.25e+51) {
tmp = x;
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 1.25e+51: tmp = x else: tmp = x + (z * (t - x)) return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 1.25e+51) tmp = x; else tmp = Float64(x + Float64(z * Float64(t - x))); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 1.25e+51) tmp = x; else tmp = x + (z * (t - x)); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[LessEqual[y, 1.25e+51], x, N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.25 \cdot 10^{+51}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 1.25e51Initial program 93.4%
associate-*l*96.7%
Simplified96.7%
Taylor expanded in x around inf 65.0%
if 1.25e51 < y Initial program 87.2%
+-commutative87.2%
*-commutative87.2%
associate-*l*95.5%
fma-def95.5%
Simplified95.5%
Taylor expanded in y around inf 78.5%
Final simplification68.0%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 6.4e-12) x (+ x (* z t))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 6.4e-12) {
tmp = x;
} else {
tmp = x + (z * t);
}
return tmp;
}
NOTE: y should be positive before calling this 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 <= 6.4d-12) then
tmp = x
else
tmp = x + (z * t)
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 6.4e-12) {
tmp = x;
} else {
tmp = x + (z * t);
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 6.4e-12: tmp = x else: tmp = x + (z * t) return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 6.4e-12) tmp = x; else tmp = Float64(x + Float64(z * t)); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 6.4e-12) tmp = x; else tmp = x + (z * t); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[LessEqual[y, 6.4e-12], x, N[(x + N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 6.4 \cdot 10^{-12}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot t\\
\end{array}
\end{array}
if y < 6.4000000000000002e-12Initial program 93.0%
associate-*l*96.6%
Simplified96.6%
Taylor expanded in x around inf 62.9%
if 6.4000000000000002e-12 < y Initial program 89.3%
associate-*l*94.7%
Simplified94.7%
Taylor expanded in x around 0 28.1%
*-commutative28.1%
associate-*r*27.5%
associate-/r*27.5%
rec-exp27.5%
div-sub27.5%
rec-exp27.5%
Simplified75.5%
Taylor expanded in y around inf 63.8%
Final simplification63.2%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= z 4.6e+107) x (* z t)))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 4.6e+107) {
tmp = x;
} else {
tmp = z * t;
}
return tmp;
}
NOTE: y should be positive before calling this 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 (z <= 4.6d+107) then
tmp = x
else
tmp = z * t
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 4.6e+107) {
tmp = x;
} else {
tmp = z * t;
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if z <= 4.6e+107: tmp = x else: tmp = z * t return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (z <= 4.6e+107) tmp = x; else tmp = Float64(z * t); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= 4.6e+107) tmp = x; else tmp = z * t; end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[LessEqual[z, 4.6e+107], x, N[(z * t), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 4.6 \cdot 10^{+107}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if z < 4.6000000000000001e107Initial program 95.2%
associate-*l*96.8%
Simplified96.8%
Taylor expanded in x around inf 62.4%
if 4.6000000000000001e107 < z Initial program 69.2%
associate-*l*90.4%
Simplified90.4%
Taylor expanded in x around 0 0.9%
*-commutative0.9%
associate-*r*0.4%
associate-/r*0.4%
rec-exp0.4%
div-sub0.4%
rec-exp0.4%
Simplified40.2%
Taylor expanded in y around inf 41.6%
Taylor expanded in x around 0 35.7%
Final simplification59.2%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 x)
y = abs(y);
double code(double x, double y, double z, double t) {
return x;
}
NOTE: y should be positive before calling this 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
code = x
end function
y = Math.abs(y);
public static double code(double x, double y, double z, double t) {
return x;
}
y = abs(y) def code(x, y, z, t): return x
y = abs(y) function code(x, y, z, t) return x end
y = abs(y) function tmp = code(x, y, z, t) tmp = x; end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := x
\begin{array}{l}
y = |y|\\
\\
x
\end{array}
Initial program 92.0%
associate-*l*96.1%
Simplified96.1%
Taylor expanded in x around inf 57.4%
Final simplification57.4%
(FPCore (x y z t) :precision binary64 (+ x (* y (* z (- (tanh (/ t y)) (tanh (/ x y)))))))
double code(double x, double y, double z, double t) {
return x + (y * (z * (tanh((t / y)) - tanh((x / y)))));
}
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
public static double code(double x, double y, double z, double t) {
return x + (y * (z * (Math.tanh((t / y)) - Math.tanh((x / y)))));
}
def code(x, y, z, t): return x + (y * (z * (math.tanh((t / y)) - math.tanh((x / y)))))
function code(x, y, z, t) return Float64(x + Float64(y * Float64(z * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y)))))) end
function tmp = code(x, y, z, t) tmp = x + (y * (z * (tanh((t / y)) - tanh((x / y))))); end
code[x_, y_, z_, t_] := N[(x + N[(y * N[(z * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)
\end{array}
herbie shell --seed 2023252
(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))))))