
(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}
(FPCore (x y z t) :precision binary64 (let* ((t_1 (- (tanh (/ t y)) (tanh (/ x y))))) (if (<= (+ x (* (* y z) t_1)) 5e+303) (fma (* y t_1) z x) (* z (- t x)))))
double code(double x, double y, double z, double t) {
double t_1 = tanh((t / y)) - tanh((x / y));
double tmp;
if ((x + ((y * z) * t_1)) <= 5e+303) {
tmp = fma((y * t_1), z, x);
} else {
tmp = z * (t - x);
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(tanh(Float64(t / y)) - tanh(Float64(x / y))) tmp = 0.0 if (Float64(x + Float64(Float64(y * z) * t_1)) <= 5e+303) tmp = fma(Float64(y * t_1), z, x); else tmp = Float64(z * Float64(t - x)); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x + N[(N[(y * z), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], 5e+303], N[(N[(y * t$95$1), $MachinePrecision] * z + x), $MachinePrecision], N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\\
\mathbf{if}\;x + \left(y \cdot z\right) \cdot t\_1 \leq 5 \cdot 10^{+303}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot t\_1, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < 4.9999999999999997e303Initial program 98.8%
lift-*.f64N/A
lift-/.f64N/A
lift-tanh.f64N/A
lift-/.f64N/A
lift-tanh.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64100.0
Applied rewrites100.0%
if 4.9999999999999997e303 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) Initial program 51.3%
Taylor expanded in y around inf
+-commutativeN/A
lower-fma.f64N/A
lower--.f64100.0
Applied rewrites100.0%
Taylor expanded in z around inf
remove-double-negN/A
mul-1-negN/A
distribute-lft-out--N/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
distribute-lft-out--N/A
mul-1-negN/A
remove-double-negN/A
lower--.f64100.0
Applied rewrites100.0%
Final simplification100.0%
(FPCore (x y z t) :precision binary64 (if (<= (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))) 5e+303) (+ x (* z t)) (* z (- t x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + ((y * z) * (tanh((t / y)) - tanh((x / y))))) <= 5e+303) {
tmp = x + (z * t);
} else {
tmp = z * (t - x);
}
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
real(8) :: tmp
if ((x + ((y * z) * (tanh((t / y)) - tanh((x / y))))) <= 5d+303) then
tmp = x + (z * t)
else
tmp = z * (t - x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x + ((y * z) * (Math.tanh((t / y)) - Math.tanh((x / y))))) <= 5e+303) {
tmp = x + (z * t);
} else {
tmp = z * (t - x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + ((y * z) * (math.tanh((t / y)) - math.tanh((x / y))))) <= 5e+303: tmp = x + (z * t) else: tmp = z * (t - x) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + Float64(Float64(y * z) * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y))))) <= 5e+303) tmp = Float64(x + Float64(z * t)); else tmp = Float64(z * Float64(t - x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + ((y * z) * (tanh((t / y)) - tanh((x / y))))) <= 5e+303) tmp = x + (z * t); else tmp = z * (t - x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[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], 5e+303], N[(x + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \leq 5 \cdot 10^{+303}:\\
\;\;\;\;x + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < 4.9999999999999997e303Initial program 98.8%
Taylor expanded in y around inf
lower-/.f64N/A
lower--.f6447.3
Applied rewrites47.3%
Taylor expanded in t around inf
lower-*.f6461.4
Applied rewrites61.4%
if 4.9999999999999997e303 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) Initial program 51.3%
Taylor expanded in y around inf
+-commutativeN/A
lower-fma.f64N/A
lower--.f64100.0
Applied rewrites100.0%
Taylor expanded in z around inf
remove-double-negN/A
mul-1-negN/A
distribute-lft-out--N/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
distribute-lft-out--N/A
mul-1-negN/A
remove-double-negN/A
lower--.f64100.0
Applied rewrites100.0%
Final simplification64.1%
(FPCore (x y z t) :precision binary64 (if (<= y 1.6e+250) (fma (* z (- (tanh (/ t y)) (tanh (/ x y)))) y x) (fma z (- t x) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.6e+250) {
tmp = fma((z * (tanh((t / y)) - tanh((x / y)))), y, x);
} else {
tmp = fma(z, (t - x), x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= 1.6e+250) tmp = fma(Float64(z * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y)))), y, x); else tmp = fma(z, Float64(t - x), x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, 1.6e+250], N[(N[(z * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision], N[(z * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.6 \cdot 10^{+250}:\\
\;\;\;\;\mathsf{fma}\left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\
\end{array}
\end{array}
if y < 1.5999999999999999e250Initial program 96.8%
lift-*.f64N/A
lift-/.f64N/A
lift-tanh.f64N/A
lift-/.f64N/A
lift-tanh.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6498.6
Applied rewrites98.6%
if 1.5999999999999999e250 < y Initial program 69.7%
Taylor expanded in y around inf
+-commutativeN/A
lower-fma.f64N/A
lower--.f64100.0
Applied rewrites100.0%
(FPCore (x y z t)
:precision binary64
(if (<= x -1.9e+75)
(+ x (* z t))
(if (<= x 7e+107)
(fma (* y (- (tanh (/ t y)) (/ x y))) z x)
(fma (* y (- (/ t y) (tanh (/ x y)))) z x))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.9e+75) {
tmp = x + (z * t);
} else if (x <= 7e+107) {
tmp = fma((y * (tanh((t / y)) - (x / y))), z, x);
} else {
tmp = fma((y * ((t / y) - tanh((x / y)))), z, x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (x <= -1.9e+75) tmp = Float64(x + Float64(z * t)); elseif (x <= 7e+107) tmp = fma(Float64(y * Float64(tanh(Float64(t / y)) - Float64(x / y))), z, x); else tmp = fma(Float64(y * Float64(Float64(t / y) - tanh(Float64(x / y)))), z, x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.9e+75], N[(x + N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7e+107], N[(N[(y * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z + x), $MachinePrecision], N[(N[(y * N[(N[(t / y), $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.9 \cdot 10^{+75}:\\
\;\;\;\;x + z \cdot t\\
\mathbf{elif}\;x \leq 7 \cdot 10^{+107}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot \left(\tanh \left(\frac{t}{y}\right) - \frac{x}{y}\right), z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot \left(\frac{t}{y} - \tanh \left(\frac{x}{y}\right)\right), z, x\right)\\
\end{array}
\end{array}
if x < -1.9000000000000001e75Initial program 100.0%
Taylor expanded in y around inf
lower-/.f64N/A
lower--.f6438.1
Applied rewrites38.1%
Taylor expanded in t around inf
lower-*.f6470.8
Applied rewrites70.8%
if -1.9000000000000001e75 < x < 6.9999999999999995e107Initial program 92.8%
Taylor expanded in x around 0
lower-/.f6476.3
Applied rewrites76.3%
lift-*.f64N/A
lift-/.f64N/A
lift-tanh.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6480.6
Applied rewrites80.6%
if 6.9999999999999995e107 < x Initial program 100.0%
lift-*.f64N/A
lift-/.f64N/A
lift-tanh.f64N/A
lift-/.f64N/A
lift-tanh.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64100.0
Applied rewrites100.0%
Taylor expanded in t around 0
lower-/.f6485.9
Applied rewrites85.9%
Final simplification79.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (* z t))))
(if (<= x -1.9e+75)
t_1
(if (<= x 6.6e+122) (fma (* y (- (tanh (/ t y)) (/ x y))) z x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x + (z * t);
double tmp;
if (x <= -1.9e+75) {
tmp = t_1;
} else if (x <= 6.6e+122) {
tmp = fma((y * (tanh((t / y)) - (x / y))), z, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(x + Float64(z * t)) tmp = 0.0 if (x <= -1.9e+75) tmp = t_1; elseif (x <= 6.6e+122) tmp = fma(Float64(y * Float64(tanh(Float64(t / y)) - Float64(x / y))), z, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.9e+75], t$95$1, If[LessEqual[x, 6.6e+122], N[(N[(y * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + z \cdot t\\
\mathbf{if}\;x \leq -1.9 \cdot 10^{+75}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 6.6 \cdot 10^{+122}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot \left(\tanh \left(\frac{t}{y}\right) - \frac{x}{y}\right), z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.9000000000000001e75 or 6.5999999999999998e122 < x Initial program 100.0%
Taylor expanded in y around inf
lower-/.f64N/A
lower--.f6437.9
Applied rewrites37.9%
Taylor expanded in t around inf
lower-*.f6472.6
Applied rewrites72.6%
if -1.9000000000000001e75 < x < 6.5999999999999998e122Initial program 92.9%
Taylor expanded in x around 0
lower-/.f6476.2
Applied rewrites76.2%
lift-*.f64N/A
lift-/.f64N/A
lift-tanh.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6480.4
Applied rewrites80.4%
Final simplification77.6%
(FPCore (x y z t) :precision binary64 (if (<= y 2.5e+102) (+ x (* z t)) (fma z (- t x) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.5e+102) {
tmp = x + (z * t);
} else {
tmp = fma(z, (t - x), x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= 2.5e+102) tmp = Float64(x + Float64(z * t)); else tmp = fma(z, Float64(t - x), x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, 2.5e+102], N[(x + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(z * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.5 \cdot 10^{+102}:\\
\;\;\;\;x + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\
\end{array}
\end{array}
if y < 2.5e102Initial program 97.3%
Taylor expanded in y around inf
lower-/.f64N/A
lower--.f6443.9
Applied rewrites43.9%
Taylor expanded in t around inf
lower-*.f6460.1
Applied rewrites60.1%
if 2.5e102 < y Initial program 83.9%
Taylor expanded in y around inf
+-commutativeN/A
lower-fma.f64N/A
lower--.f6485.9
Applied rewrites85.9%
Final simplification63.7%
(FPCore (x y z t) :precision binary64 (if (<= x 8e-21) (* z t) (* z (- x))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 8e-21) {
tmp = z * t;
} else {
tmp = z * -x;
}
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
real(8) :: tmp
if (x <= 8d-21) then
tmp = z * t
else
tmp = z * -x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 8e-21) {
tmp = z * t;
} else {
tmp = z * -x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= 8e-21: tmp = z * t else: tmp = z * -x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= 8e-21) tmp = Float64(z * t); else tmp = Float64(z * Float64(-x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= 8e-21) tmp = z * t; else tmp = z * -x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, 8e-21], N[(z * t), $MachinePrecision], N[(z * (-x)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 8 \cdot 10^{-21}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-x\right)\\
\end{array}
\end{array}
if x < 7.99999999999999926e-21Initial program 94.0%
Taylor expanded in y around inf
+-commutativeN/A
lower-fma.f64N/A
lower--.f6461.7
Applied rewrites61.7%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6421.2
Applied rewrites21.2%
if 7.99999999999999926e-21 < x Initial program 98.8%
Taylor expanded in y around inf
+-commutativeN/A
lower-fma.f64N/A
lower--.f6456.7
Applied rewrites56.7%
Taylor expanded in z around inf
remove-double-negN/A
mul-1-negN/A
distribute-lft-out--N/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
distribute-lft-out--N/A
mul-1-negN/A
remove-double-negN/A
lower--.f6413.8
Applied rewrites13.8%
Taylor expanded in t around 0
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6413.8
Applied rewrites13.8%
Final simplification19.0%
(FPCore (x y z t) :precision binary64 (* z (- t x)))
double code(double x, double y, double z, double t) {
return z * (t - x);
}
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 = z * (t - x)
end function
public static double code(double x, double y, double z, double t) {
return z * (t - x);
}
def code(x, y, z, t): return z * (t - x)
function code(x, y, z, t) return Float64(z * Float64(t - x)) end
function tmp = code(x, y, z, t) tmp = z * (t - x); end
code[x_, y_, z_, t_] := N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
z \cdot \left(t - x\right)
\end{array}
Initial program 95.4%
Taylor expanded in y around inf
+-commutativeN/A
lower-fma.f64N/A
lower--.f6460.2
Applied rewrites60.2%
Taylor expanded in z around inf
remove-double-negN/A
mul-1-negN/A
distribute-lft-out--N/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
distribute-lft-out--N/A
mul-1-negN/A
remove-double-negN/A
lower--.f6422.0
Applied rewrites22.0%
(FPCore (x y z t) :precision binary64 (* z t))
double code(double x, double y, double z, double t) {
return z * t;
}
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 = z * t
end function
public static double code(double x, double y, double z, double t) {
return z * t;
}
def code(x, y, z, t): return z * t
function code(x, y, z, t) return Float64(z * t) end
function tmp = code(x, y, z, t) tmp = z * t; end
code[x_, y_, z_, t_] := N[(z * t), $MachinePrecision]
\begin{array}{l}
\\
z \cdot t
\end{array}
Initial program 95.4%
Taylor expanded in y around inf
+-commutativeN/A
lower-fma.f64N/A
lower--.f6460.2
Applied rewrites60.2%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6416.0
Applied rewrites16.0%
(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 2024216
(FPCore (x y z t)
:name "SynthBasics:moogVCF from YampaSynth-0.2"
:precision binary64
:alt
(! :herbie-platform default (+ x (* y (* z (- (tanh (/ t y)) (tanh (/ x y)))))))
(+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))))