
(FPCore (x y z t) :precision binary64 (+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5.0)))
double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
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) + z) + y) + t)) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
def code(x, y, z, t): return (x * ((((y + z) + z) + y) + t)) + (y * 5.0)
function code(x, y, z, t) return Float64(Float64(x * Float64(Float64(Float64(Float64(y + z) + z) + y) + t)) + Float64(y * 5.0)) end
function tmp = code(x, y, z, t) tmp = (x * ((((y + z) + z) + y) + t)) + (y * 5.0); end
code[x_, y_, z_, t_] := N[(N[(x * N[(N[(N[(N[(y + z), $MachinePrecision] + z), $MachinePrecision] + y), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5.0)))
double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
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) + z) + y) + t)) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
def code(x, y, z, t): return (x * ((((y + z) + z) + y) + t)) + (y * 5.0)
function code(x, y, z, t) return Float64(Float64(x * Float64(Float64(Float64(Float64(y + z) + z) + y) + t)) + Float64(y * 5.0)) end
function tmp = code(x, y, z, t) tmp = (x * ((((y + z) + z) + y) + t)) + (y * 5.0); end
code[x_, y_, z_, t_] := N[(N[(x * N[(N[(N[(N[(y + z), $MachinePrecision] + z), $MachinePrecision] + y), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5
\end{array}
(FPCore (x y z t) :precision binary64 (+ (* x (+ (+ y (+ z (+ y z))) t)) (* y 5.0)))
double code(double x, double y, double z, double t) {
return (x * ((y + (z + (y + z))) + t)) + (y * 5.0);
}
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 + (y + z))) + t)) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x * ((y + (z + (y + z))) + t)) + (y * 5.0);
}
def code(x, y, z, t): return (x * ((y + (z + (y + z))) + t)) + (y * 5.0)
function code(x, y, z, t) return Float64(Float64(x * Float64(Float64(y + Float64(z + Float64(y + z))) + t)) + Float64(y * 5.0)) end
function tmp = code(x, y, z, t) tmp = (x * ((y + (z + (y + z))) + t)) + (y * 5.0); end
code[x_, y_, z_, t_] := N[(N[(x * N[(N[(y + N[(z + N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\left(y + \left(z + \left(y + z\right)\right)\right) + t\right) + y \cdot 5
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (fma x 2.0 5.0))))
(if (<= y -2.85e+122)
t_1
(if (<= y -6.6e-56)
(fma y 5.0 (* x t))
(if (<= y 3.3e+16) (* x (fma 2.0 z t)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = y * fma(x, 2.0, 5.0);
double tmp;
if (y <= -2.85e+122) {
tmp = t_1;
} else if (y <= -6.6e-56) {
tmp = fma(y, 5.0, (x * t));
} else if (y <= 3.3e+16) {
tmp = x * fma(2.0, z, t);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(y * fma(x, 2.0, 5.0)) tmp = 0.0 if (y <= -2.85e+122) tmp = t_1; elseif (y <= -6.6e-56) tmp = fma(y, 5.0, Float64(x * t)); elseif (y <= 3.3e+16) tmp = Float64(x * fma(2.0, z, t)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(x * 2.0 + 5.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.85e+122], t$95$1, If[LessEqual[y, -6.6e-56], N[(y * 5.0 + N[(x * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.3e+16], N[(x * N[(2.0 * z + t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \mathsf{fma}\left(x, 2, 5\right)\\
\mathbf{if}\;y \leq -2.85 \cdot 10^{+122}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -6.6 \cdot 10^{-56}:\\
\;\;\;\;\mathsf{fma}\left(y, 5, x \cdot t\right)\\
\mathbf{elif}\;y \leq 3.3 \cdot 10^{+16}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(2, z, t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -2.85000000000000003e122 or 3.3e16 < y Initial program 99.9%
Taylor expanded in y around inf
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
neg-sub0N/A
associate--r-N/A
neg-sub0N/A
*-lowering-*.f64N/A
neg-sub0N/A
associate--r-N/A
neg-sub0N/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-commutativeN/A
accelerator-lowering-fma.f6484.7
Simplified84.7%
if -2.85000000000000003e122 < y < -6.59999999999999967e-56Initial program 100.0%
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
associate-+l+N/A
+-commutativeN/A
flip-+N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
+-lowering-+.f6490.8
Applied egg-rr90.8%
Taylor expanded in z around 0
*-commutativeN/A
*-lowering-*.f6485.5
Simplified85.5%
if -6.59999999999999967e-56 < y < 3.3e16Initial program 99.9%
Taylor expanded in y around 0
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6480.8
Simplified80.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (fma 2.0 z t))))
(if (<= x -1.3e-174)
t_1
(if (<= x 5e-109) (* y 5.0) (if (<= x 2e+102) t_1 (* x (fma y 2.0 t)))))))
double code(double x, double y, double z, double t) {
double t_1 = x * fma(2.0, z, t);
double tmp;
if (x <= -1.3e-174) {
tmp = t_1;
} else if (x <= 5e-109) {
tmp = y * 5.0;
} else if (x <= 2e+102) {
tmp = t_1;
} else {
tmp = x * fma(y, 2.0, t);
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(x * fma(2.0, z, t)) tmp = 0.0 if (x <= -1.3e-174) tmp = t_1; elseif (x <= 5e-109) tmp = Float64(y * 5.0); elseif (x <= 2e+102) tmp = t_1; else tmp = Float64(x * fma(y, 2.0, t)); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(2.0 * z + t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.3e-174], t$95$1, If[LessEqual[x, 5e-109], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 2e+102], t$95$1, N[(x * N[(y * 2.0 + t), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \mathsf{fma}\left(2, z, t\right)\\
\mathbf{if}\;x \leq -1.3 \cdot 10^{-174}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 5 \cdot 10^{-109}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 2 \cdot 10^{+102}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(y, 2, t\right)\\
\end{array}
\end{array}
if x < -1.3000000000000001e-174 or 5.0000000000000002e-109 < x < 1.99999999999999995e102Initial program 99.9%
Taylor expanded in y around 0
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6468.4
Simplified68.4%
if -1.3000000000000001e-174 < x < 5.0000000000000002e-109Initial program 99.9%
Taylor expanded in x around 0
*-lowering-*.f6474.0
Simplified74.0%
if 1.99999999999999995e102 < x Initial program 100.0%
Taylor expanded in x around inf
*-lowering-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
accelerator-lowering-fma.f64N/A
+-lowering-+.f64100.0
Simplified100.0%
Taylor expanded in z around 0
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6475.0
Simplified75.0%
Final simplification71.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (fma 2.0 (+ y z) t))))
(if (<= x -5800.0)
t_1
(if (<= x 2.05e-13) (fma y 5.0 (* x (+ t (+ z z)))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * fma(2.0, (y + z), t);
double tmp;
if (x <= -5800.0) {
tmp = t_1;
} else if (x <= 2.05e-13) {
tmp = fma(y, 5.0, (x * (t + (z + z))));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(x * fma(2.0, Float64(y + z), t)) tmp = 0.0 if (x <= -5800.0) tmp = t_1; elseif (x <= 2.05e-13) tmp = fma(y, 5.0, Float64(x * Float64(t + Float64(z + z)))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(2.0 * N[(y + z), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5800.0], t$95$1, If[LessEqual[x, 2.05e-13], N[(y * 5.0 + N[(x * N[(t + N[(z + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \mathsf{fma}\left(2, y + z, t\right)\\
\mathbf{if}\;x \leq -5800:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.05 \cdot 10^{-13}:\\
\;\;\;\;\mathsf{fma}\left(y, 5, x \cdot \left(t + \left(z + z\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -5800 or 2.0500000000000001e-13 < x Initial program 100.0%
Taylor expanded in x around inf
*-lowering-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
accelerator-lowering-fma.f64N/A
+-lowering-+.f6499.1
Simplified99.1%
if -5800 < x < 2.0500000000000001e-13Initial program 99.9%
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
associate-+l+N/A
+-commutativeN/A
flip-+N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
+-lowering-+.f64100.0
Applied egg-rr100.0%
Final simplification99.5%
(FPCore (x y z t)
:precision binary64
(if (<= x -1.35e-32)
(* x t)
(if (<= x 3.8e-109)
(* y 5.0)
(if (<= x 2e+226) (* x (* z 2.0)) (* y (* x 2.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.35e-32) {
tmp = x * t;
} else if (x <= 3.8e-109) {
tmp = y * 5.0;
} else if (x <= 2e+226) {
tmp = x * (z * 2.0);
} else {
tmp = y * (x * 2.0);
}
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 <= (-1.35d-32)) then
tmp = x * t
else if (x <= 3.8d-109) then
tmp = y * 5.0d0
else if (x <= 2d+226) then
tmp = x * (z * 2.0d0)
else
tmp = y * (x * 2.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.35e-32) {
tmp = x * t;
} else if (x <= 3.8e-109) {
tmp = y * 5.0;
} else if (x <= 2e+226) {
tmp = x * (z * 2.0);
} else {
tmp = y * (x * 2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.35e-32: tmp = x * t elif x <= 3.8e-109: tmp = y * 5.0 elif x <= 2e+226: tmp = x * (z * 2.0) else: tmp = y * (x * 2.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.35e-32) tmp = Float64(x * t); elseif (x <= 3.8e-109) tmp = Float64(y * 5.0); elseif (x <= 2e+226) tmp = Float64(x * Float64(z * 2.0)); else tmp = Float64(y * Float64(x * 2.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -1.35e-32) tmp = x * t; elseif (x <= 3.8e-109) tmp = y * 5.0; elseif (x <= 2e+226) tmp = x * (z * 2.0); else tmp = y * (x * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.35e-32], N[(x * t), $MachinePrecision], If[LessEqual[x, 3.8e-109], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 2e+226], N[(x * N[(z * 2.0), $MachinePrecision]), $MachinePrecision], N[(y * N[(x * 2.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.35 \cdot 10^{-32}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 3.8 \cdot 10^{-109}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 2 \cdot 10^{+226}:\\
\;\;\;\;x \cdot \left(z \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x \cdot 2\right)\\
\end{array}
\end{array}
if x < -1.3499999999999999e-32Initial program 99.9%
Taylor expanded in t around inf
*-commutativeN/A
*-lowering-*.f6444.8
Simplified44.8%
if -1.3499999999999999e-32 < x < 3.80000000000000002e-109Initial program 99.9%
Taylor expanded in x around 0
*-lowering-*.f6468.8
Simplified68.8%
if 3.80000000000000002e-109 < x < 1.99999999999999992e226Initial program 100.0%
Taylor expanded in z around inf
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f6446.3
Simplified46.3%
if 1.99999999999999992e226 < x Initial program 100.0%
Taylor expanded in y around inf
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
neg-sub0N/A
associate--r-N/A
neg-sub0N/A
*-lowering-*.f64N/A
neg-sub0N/A
associate--r-N/A
neg-sub0N/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-commutativeN/A
accelerator-lowering-fma.f6449.3
Simplified49.3%
Taylor expanded in x around inf
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6449.3
Simplified49.3%
Final simplification56.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (fma 2.0 (+ y z) t))))
(if (<= x -1.05e-30)
t_1
(if (<= x 8.8e-18) (fma y 5.0 (* x (+ z z))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * fma(2.0, (y + z), t);
double tmp;
if (x <= -1.05e-30) {
tmp = t_1;
} else if (x <= 8.8e-18) {
tmp = fma(y, 5.0, (x * (z + z)));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(x * fma(2.0, Float64(y + z), t)) tmp = 0.0 if (x <= -1.05e-30) tmp = t_1; elseif (x <= 8.8e-18) tmp = fma(y, 5.0, Float64(x * Float64(z + z))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(2.0 * N[(y + z), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.05e-30], t$95$1, If[LessEqual[x, 8.8e-18], N[(y * 5.0 + N[(x * N[(z + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \mathsf{fma}\left(2, y + z, t\right)\\
\mathbf{if}\;x \leq -1.05 \cdot 10^{-30}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 8.8 \cdot 10^{-18}:\\
\;\;\;\;\mathsf{fma}\left(y, 5, x \cdot \left(z + z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.0500000000000001e-30 or 8.7999999999999994e-18 < x Initial program 100.0%
Taylor expanded in x around inf
*-lowering-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
accelerator-lowering-fma.f64N/A
+-lowering-+.f6499.1
Simplified99.1%
if -1.0500000000000001e-30 < x < 8.7999999999999994e-18Initial program 99.9%
Taylor expanded in z around -inf
Simplified99.9%
Taylor expanded in x around 0
*-lowering-*.f6485.8
Simplified85.8%
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
count-2N/A
+-lowering-+.f6485.8
Applied egg-rr85.8%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (fma 2.0 (+ y z) t)))) (if (<= x -2.4e-27) t_1 (if (<= x 6.5e-109) (fma y 5.0 (* x t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * fma(2.0, (y + z), t);
double tmp;
if (x <= -2.4e-27) {
tmp = t_1;
} else if (x <= 6.5e-109) {
tmp = fma(y, 5.0, (x * t));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(x * fma(2.0, Float64(y + z), t)) tmp = 0.0 if (x <= -2.4e-27) tmp = t_1; elseif (x <= 6.5e-109) tmp = fma(y, 5.0, Float64(x * t)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(2.0 * N[(y + z), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.4e-27], t$95$1, If[LessEqual[x, 6.5e-109], N[(y * 5.0 + N[(x * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \mathsf{fma}\left(2, y + z, t\right)\\
\mathbf{if}\;x \leq -2.4 \cdot 10^{-27}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 6.5 \cdot 10^{-109}:\\
\;\;\;\;\mathsf{fma}\left(y, 5, x \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -2.40000000000000002e-27 or 6.49999999999999959e-109 < x Initial program 100.0%
Taylor expanded in x around inf
*-lowering-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
accelerator-lowering-fma.f64N/A
+-lowering-+.f6495.9
Simplified95.9%
if -2.40000000000000002e-27 < x < 6.49999999999999959e-109Initial program 99.9%
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
associate-+l+N/A
+-commutativeN/A
flip-+N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
+-lowering-+.f6499.9
Applied egg-rr99.9%
Taylor expanded in z around 0
*-commutativeN/A
*-lowering-*.f6483.4
Simplified83.4%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* y (fma x 2.0 5.0)))) (if (<= y -44000.0) t_1 (if (<= y 7e+19) (* x (fma 2.0 z t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = y * fma(x, 2.0, 5.0);
double tmp;
if (y <= -44000.0) {
tmp = t_1;
} else if (y <= 7e+19) {
tmp = x * fma(2.0, z, t);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(y * fma(x, 2.0, 5.0)) tmp = 0.0 if (y <= -44000.0) tmp = t_1; elseif (y <= 7e+19) tmp = Float64(x * fma(2.0, z, t)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(x * 2.0 + 5.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -44000.0], t$95$1, If[LessEqual[y, 7e+19], N[(x * N[(2.0 * z + t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \mathsf{fma}\left(x, 2, 5\right)\\
\mathbf{if}\;y \leq -44000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 7 \cdot 10^{+19}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(2, z, t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -44000 or 7e19 < y Initial program 99.9%
Taylor expanded in y around inf
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
neg-sub0N/A
associate--r-N/A
neg-sub0N/A
*-lowering-*.f64N/A
neg-sub0N/A
associate--r-N/A
neg-sub0N/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-commutativeN/A
accelerator-lowering-fma.f6480.1
Simplified80.1%
if -44000 < y < 7e19Initial program 100.0%
Taylor expanded in y around 0
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6478.2
Simplified78.2%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (fma 2.0 z t)))) (if (<= x -1.3e-174) t_1 (if (<= x 6.4e-112) (* y 5.0) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * fma(2.0, z, t);
double tmp;
if (x <= -1.3e-174) {
tmp = t_1;
} else if (x <= 6.4e-112) {
tmp = y * 5.0;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(x * fma(2.0, z, t)) tmp = 0.0 if (x <= -1.3e-174) tmp = t_1; elseif (x <= 6.4e-112) tmp = Float64(y * 5.0); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(2.0 * z + t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.3e-174], t$95$1, If[LessEqual[x, 6.4e-112], N[(y * 5.0), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \mathsf{fma}\left(2, z, t\right)\\
\mathbf{if}\;x \leq -1.3 \cdot 10^{-174}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 6.4 \cdot 10^{-112}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.3000000000000001e-174 or 6.39999999999999986e-112 < x Initial program 100.0%
Taylor expanded in y around 0
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6466.8
Simplified66.8%
if -1.3000000000000001e-174 < x < 6.39999999999999986e-112Initial program 99.9%
Taylor expanded in x around 0
*-lowering-*.f6474.0
Simplified74.0%
Final simplification69.3%
(FPCore (x y z t) :precision binary64 (if (<= x -2.4e-31) (* x t) (if (<= x 5.8e-109) (* y 5.0) (* x (* z 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.4e-31) {
tmp = x * t;
} else if (x <= 5.8e-109) {
tmp = y * 5.0;
} else {
tmp = x * (z * 2.0);
}
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 <= (-2.4d-31)) then
tmp = x * t
else if (x <= 5.8d-109) then
tmp = y * 5.0d0
else
tmp = x * (z * 2.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.4e-31) {
tmp = x * t;
} else if (x <= 5.8e-109) {
tmp = y * 5.0;
} else {
tmp = x * (z * 2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.4e-31: tmp = x * t elif x <= 5.8e-109: tmp = y * 5.0 else: tmp = x * (z * 2.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.4e-31) tmp = Float64(x * t); elseif (x <= 5.8e-109) tmp = Float64(y * 5.0); else tmp = Float64(x * Float64(z * 2.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2.4e-31) tmp = x * t; elseif (x <= 5.8e-109) tmp = y * 5.0; else tmp = x * (z * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.4e-31], N[(x * t), $MachinePrecision], If[LessEqual[x, 5.8e-109], N[(y * 5.0), $MachinePrecision], N[(x * N[(z * 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.4 \cdot 10^{-31}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 5.8 \cdot 10^{-109}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z \cdot 2\right)\\
\end{array}
\end{array}
if x < -2.4e-31Initial program 99.9%
Taylor expanded in t around inf
*-commutativeN/A
*-lowering-*.f6444.8
Simplified44.8%
if -2.4e-31 < x < 5.8e-109Initial program 99.9%
Taylor expanded in x around 0
*-lowering-*.f6468.8
Simplified68.8%
if 5.8e-109 < x Initial program 100.0%
Taylor expanded in z around inf
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f6441.3
Simplified41.3%
Final simplification54.4%
(FPCore (x y z t) :precision binary64 (if (<= x -5.4e-36) (* x t) (if (<= x 2.85e-14) (* y 5.0) (* x t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -5.4e-36) {
tmp = x * t;
} else if (x <= 2.85e-14) {
tmp = y * 5.0;
} else {
tmp = x * t;
}
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 <= (-5.4d-36)) then
tmp = x * t
else if (x <= 2.85d-14) then
tmp = y * 5.0d0
else
tmp = x * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -5.4e-36) {
tmp = x * t;
} else if (x <= 2.85e-14) {
tmp = y * 5.0;
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -5.4e-36: tmp = x * t elif x <= 2.85e-14: tmp = y * 5.0 else: tmp = x * t return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -5.4e-36) tmp = Float64(x * t); elseif (x <= 2.85e-14) tmp = Float64(y * 5.0); else tmp = Float64(x * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -5.4e-36) tmp = x * t; elseif (x <= 2.85e-14) tmp = y * 5.0; else tmp = x * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -5.4e-36], N[(x * t), $MachinePrecision], If[LessEqual[x, 2.85e-14], N[(y * 5.0), $MachinePrecision], N[(x * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.4 \cdot 10^{-36}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 2.85 \cdot 10^{-14}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if x < -5.40000000000000015e-36 or 2.84999999999999985e-14 < x Initial program 100.0%
Taylor expanded in t around inf
*-commutativeN/A
*-lowering-*.f6438.9
Simplified38.9%
if -5.40000000000000015e-36 < x < 2.84999999999999985e-14Initial program 99.9%
Taylor expanded in x around 0
*-lowering-*.f6464.9
Simplified64.9%
Final simplification52.0%
(FPCore (x y z t) :precision binary64 (* y 5.0))
double code(double x, double y, double z, double t) {
return y * 5.0;
}
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 = y * 5.0d0
end function
public static double code(double x, double y, double z, double t) {
return y * 5.0;
}
def code(x, y, z, t): return y * 5.0
function code(x, y, z, t) return Float64(y * 5.0) end
function tmp = code(x, y, z, t) tmp = y * 5.0; end
code[x_, y_, z_, t_] := N[(y * 5.0), $MachinePrecision]
\begin{array}{l}
\\
y \cdot 5
\end{array}
Initial program 99.9%
Taylor expanded in x around 0
*-lowering-*.f6434.1
Simplified34.1%
Final simplification34.1%
herbie shell --seed 2024205
(FPCore (x y z t)
:name "Graphics.Rendering.Plot.Render.Plot.Legend:renderLegendOutside from plot-0.2.3.4, B"
:precision binary64
(+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5.0)))