
(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 (fma y 5.0 (* x (fma 2.0 (+ y z) t))))
double code(double x, double y, double z, double t) {
return fma(y, 5.0, (x * fma(2.0, (y + z), t)));
}
function code(x, y, z, t) return fma(y, 5.0, Float64(x * fma(2.0, Float64(y + z), t))) end
code[x_, y_, z_, t_] := N[(y * 5.0 + N[(x * N[(2.0 * N[(y + z), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, 5, x \cdot \mathsf{fma}\left(2, y + z, t\right)\right)
\end{array}
Initial program 99.9%
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
distribute-rgt-inN/A
lower-fma.f64N/A
Applied rewrites97.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6498.0
lift-fma.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
lift-+.f64N/A
lift-+.f64N/A
associate-+r+N/A
lift-+.f64N/A
associate-+l+N/A
distribute-lft-inN/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
count-2N/A
distribute-lft-inN/A
lift-fma.f64N/A
Applied rewrites100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (fma 2.0 z t))))
(if (<= x -1.5e+35)
(* x (+ t (+ y y)))
(if (<= x -9.2e-27) t_1 (if (<= x 1.26e-65) (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, z, t);
double tmp;
if (x <= -1.5e+35) {
tmp = x * (t + (y + y));
} else if (x <= -9.2e-27) {
tmp = t_1;
} else if (x <= 1.26e-65) {
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, z, t)) tmp = 0.0 if (x <= -1.5e+35) tmp = Float64(x * Float64(t + Float64(y + y))); elseif (x <= -9.2e-27) tmp = t_1; elseif (x <= 1.26e-65) 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 * z + t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.5e+35], N[(x * N[(t + N[(y + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -9.2e-27], t$95$1, If[LessEqual[x, 1.26e-65], 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, z, t\right)\\
\mathbf{if}\;x \leq -1.5 \cdot 10^{+35}:\\
\;\;\;\;x \cdot \left(t + \left(y + y\right)\right)\\
\mathbf{elif}\;x \leq -9.2 \cdot 10^{-27}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.26 \cdot 10^{-65}:\\
\;\;\;\;\mathsf{fma}\left(y, 5, x \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.49999999999999995e35Initial program 100.0%
Taylor expanded in x around inf
lower-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in z around 0
Applied rewrites80.4%
if -1.49999999999999995e35 < x < -9.1999999999999998e-27 or 1.26e-65 < x Initial program 99.9%
Taylor expanded in y around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6478.7
Applied rewrites78.7%
if -9.1999999999999998e-27 < x < 1.26e-65Initial program 99.8%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.8
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
flip-+N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
lower-+.f6499.8
Applied rewrites99.8%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6484.3
Applied rewrites84.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (fma 2.0 z t))))
(if (<= x -1.5e+35)
(* x (+ t (+ y y)))
(if (<= x -3.1e-28) t_1 (if (<= x 2.5e-144) (* 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.5e+35) {
tmp = x * (t + (y + y));
} else if (x <= -3.1e-28) {
tmp = t_1;
} else if (x <= 2.5e-144) {
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.5e+35) tmp = Float64(x * Float64(t + Float64(y + y))); elseif (x <= -3.1e-28) tmp = t_1; elseif (x <= 2.5e-144) 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.5e+35], N[(x * N[(t + N[(y + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -3.1e-28], t$95$1, If[LessEqual[x, 2.5e-144], 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.5 \cdot 10^{+35}:\\
\;\;\;\;x \cdot \left(t + \left(y + y\right)\right)\\
\mathbf{elif}\;x \leq -3.1 \cdot 10^{-28}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{-144}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.49999999999999995e35Initial program 100.0%
Taylor expanded in x around inf
lower-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in z around 0
Applied rewrites80.4%
if -1.49999999999999995e35 < x < -3.09999999999999992e-28 or 2.4999999999999999e-144 < x Initial program 99.9%
Taylor expanded in y around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6476.0
Applied rewrites76.0%
if -3.09999999999999992e-28 < x < 2.4999999999999999e-144Initial program 99.9%
Taylor expanded in x around 0
lower-*.f6473.3
Applied rewrites73.3%
Final simplification76.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (fma 2.0 (+ y z) t))))
(if (<= x -15800.0)
t_1
(if (<= x 2.5) (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 <= -15800.0) {
tmp = t_1;
} else if (x <= 2.5) {
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 <= -15800.0) tmp = t_1; elseif (x <= 2.5) 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, -15800.0], t$95$1, If[LessEqual[x, 2.5], 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 -15800:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.5:\\
\;\;\;\;\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 < -15800 or 2.5 < x Initial program 100.0%
Taylor expanded in x around inf
lower-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-+.f6499.6
Applied rewrites99.6%
if -15800 < x < 2.5Initial program 99.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64100.0
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
flip-+N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
lower-+.f6498.8
Applied rewrites98.8%
Final simplification99.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (fma 2.0 (+ y z) t))))
(if (<= x -3.9e-7)
t_1
(if (<= x 1.75e-97) (fma y 5.0 (* x (* 2.0 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 <= -3.9e-7) {
tmp = t_1;
} else if (x <= 1.75e-97) {
tmp = fma(y, 5.0, (x * (2.0 * 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 <= -3.9e-7) tmp = t_1; elseif (x <= 1.75e-97) tmp = fma(y, 5.0, Float64(x * Float64(2.0 * 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, -3.9e-7], t$95$1, If[LessEqual[x, 1.75e-97], N[(y * 5.0 + N[(x * N[(2.0 * 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 -3.9 \cdot 10^{-7}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.75 \cdot 10^{-97}:\\
\;\;\;\;\mathsf{fma}\left(y, 5, x \cdot \left(2 \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -3.90000000000000025e-7 or 1.7500000000000001e-97 < x Initial program 100.0%
Taylor expanded in x around inf
lower-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-+.f6497.0
Applied rewrites97.0%
if -3.90000000000000025e-7 < x < 1.7500000000000001e-97Initial program 99.8%
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
distribute-rgt-inN/A
lower-fma.f64N/A
Applied rewrites99.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64100.0
lift-fma.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
lift-+.f64N/A
lift-+.f64N/A
associate-+r+N/A
lift-+.f64N/A
associate-+l+N/A
distribute-lft-inN/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
count-2N/A
distribute-lft-inN/A
lift-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in z around inf
lower-*.f6485.9
Applied rewrites85.9%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (fma 2.0 (+ y z) t)))) (if (<= x -9.2e-27) t_1 (if (<= x 8.1e-72) (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 <= -9.2e-27) {
tmp = t_1;
} else if (x <= 8.1e-72) {
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 <= -9.2e-27) tmp = t_1; elseif (x <= 8.1e-72) 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, -9.2e-27], t$95$1, If[LessEqual[x, 8.1e-72], 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 -9.2 \cdot 10^{-27}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 8.1 \cdot 10^{-72}:\\
\;\;\;\;\mathsf{fma}\left(y, 5, x \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -9.1999999999999998e-27 or 8.1000000000000004e-72 < x Initial program 100.0%
Taylor expanded in x around inf
lower-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-+.f6495.4
Applied rewrites95.4%
if -9.1999999999999998e-27 < x < 8.1000000000000004e-72Initial program 99.8%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.8
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
flip-+N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
lower-+.f6499.8
Applied rewrites99.8%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6485.0
Applied rewrites85.0%
(FPCore (x y z t) :precision binary64 (if (<= x -1.6e+34) (* x (+ y y)) (if (<= x -9.2e-27) (* x (+ z z)) (if (<= x 8e-66) (* y 5.0) (* x t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.6e+34) {
tmp = x * (y + y);
} else if (x <= -9.2e-27) {
tmp = x * (z + z);
} else if (x <= 8e-66) {
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 <= (-1.6d+34)) then
tmp = x * (y + y)
else if (x <= (-9.2d-27)) then
tmp = x * (z + z)
else if (x <= 8d-66) 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 <= -1.6e+34) {
tmp = x * (y + y);
} else if (x <= -9.2e-27) {
tmp = x * (z + z);
} else if (x <= 8e-66) {
tmp = y * 5.0;
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.6e+34: tmp = x * (y + y) elif x <= -9.2e-27: tmp = x * (z + z) elif x <= 8e-66: tmp = y * 5.0 else: tmp = x * t return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.6e+34) tmp = Float64(x * Float64(y + y)); elseif (x <= -9.2e-27) tmp = Float64(x * Float64(z + z)); elseif (x <= 8e-66) 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 <= -1.6e+34) tmp = x * (y + y); elseif (x <= -9.2e-27) tmp = x * (z + z); elseif (x <= 8e-66) tmp = y * 5.0; else tmp = x * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.6e+34], N[(x * N[(y + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -9.2e-27], N[(x * N[(z + z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 8e-66], N[(y * 5.0), $MachinePrecision], N[(x * t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.6 \cdot 10^{+34}:\\
\;\;\;\;x \cdot \left(y + y\right)\\
\mathbf{elif}\;x \leq -9.2 \cdot 10^{-27}:\\
\;\;\;\;x \cdot \left(z + z\right)\\
\mathbf{elif}\;x \leq 8 \cdot 10^{-66}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if x < -1.5999999999999999e34Initial program 100.0%
Taylor expanded in x around inf
lower-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in y around inf
Applied rewrites50.6%
if -1.5999999999999999e34 < x < -9.1999999999999998e-27Initial program 99.8%
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
distribute-rgt-inN/A
lower-fma.f64N/A
Applied rewrites99.8%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6451.0
Applied rewrites51.0%
Applied rewrites51.0%
if -9.1999999999999998e-27 < x < 7.9999999999999998e-66Initial program 99.8%
Taylor expanded in x around 0
lower-*.f6469.1
Applied rewrites69.1%
if 7.9999999999999998e-66 < x Initial program 100.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6444.2
Applied rewrites44.2%
Final simplification56.3%
(FPCore (x y z t) :precision binary64 (if (<= x -1.45e+35) (* x (+ y y)) (if (<= x -3.9e-7) (* x t) (if (<= x 8e-66) (* y 5.0) (* x t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.45e+35) {
tmp = x * (y + y);
} else if (x <= -3.9e-7) {
tmp = x * t;
} else if (x <= 8e-66) {
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 <= (-1.45d+35)) then
tmp = x * (y + y)
else if (x <= (-3.9d-7)) then
tmp = x * t
else if (x <= 8d-66) 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 <= -1.45e+35) {
tmp = x * (y + y);
} else if (x <= -3.9e-7) {
tmp = x * t;
} else if (x <= 8e-66) {
tmp = y * 5.0;
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.45e+35: tmp = x * (y + y) elif x <= -3.9e-7: tmp = x * t elif x <= 8e-66: tmp = y * 5.0 else: tmp = x * t return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.45e+35) tmp = Float64(x * Float64(y + y)); elseif (x <= -3.9e-7) tmp = Float64(x * t); elseif (x <= 8e-66) 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 <= -1.45e+35) tmp = x * (y + y); elseif (x <= -3.9e-7) tmp = x * t; elseif (x <= 8e-66) tmp = y * 5.0; else tmp = x * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.45e+35], N[(x * N[(y + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -3.9e-7], N[(x * t), $MachinePrecision], If[LessEqual[x, 8e-66], N[(y * 5.0), $MachinePrecision], N[(x * t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.45 \cdot 10^{+35}:\\
\;\;\;\;x \cdot \left(y + y\right)\\
\mathbf{elif}\;x \leq -3.9 \cdot 10^{-7}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 8 \cdot 10^{-66}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if x < -1.44999999999999997e35Initial program 100.0%
Taylor expanded in x around inf
lower-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in y around inf
Applied rewrites51.3%
if -1.44999999999999997e35 < x < -3.90000000000000025e-7 or 7.9999999999999998e-66 < x Initial program 100.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6445.3
Applied rewrites45.3%
if -3.90000000000000025e-7 < x < 7.9999999999999998e-66Initial program 99.8%
Taylor expanded in x around 0
lower-*.f6466.2
Applied rewrites66.2%
Final simplification55.8%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* y (fma x 2.0 5.0)))) (if (<= y -38.0) t_1 (if (<= y 2.85e+76) (* 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 <= -38.0) {
tmp = t_1;
} else if (y <= 2.85e+76) {
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 <= -38.0) tmp = t_1; elseif (y <= 2.85e+76) 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, -38.0], t$95$1, If[LessEqual[y, 2.85e+76], 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 -38:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.85 \cdot 10^{+76}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(2, z, t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -38 or 2.85000000000000002e76 < 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
lower-*.f64N/A
neg-sub0N/A
associate--r-N/A
neg-sub0N/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-commutativeN/A
lower-fma.f6478.1
Applied rewrites78.1%
if -38 < y < 2.85000000000000002e76Initial program 99.9%
Taylor expanded in y around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6480.3
Applied rewrites80.3%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (+ t (+ y y))))) (if (<= x -6e-5) t_1 (if (<= x 1.75e-97) (* y 5.0) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t + (y + y));
double tmp;
if (x <= -6e-5) {
tmp = t_1;
} else if (x <= 1.75e-97) {
tmp = y * 5.0;
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_1 = x * (t + (y + y))
if (x <= (-6d-5)) then
tmp = t_1
else if (x <= 1.75d-97) then
tmp = y * 5.0d0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (t + (y + y));
double tmp;
if (x <= -6e-5) {
tmp = t_1;
} else if (x <= 1.75e-97) {
tmp = y * 5.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t + (y + y)) tmp = 0 if x <= -6e-5: tmp = t_1 elif x <= 1.75e-97: tmp = y * 5.0 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t + Float64(y + y))) tmp = 0.0 if (x <= -6e-5) tmp = t_1; elseif (x <= 1.75e-97) tmp = Float64(y * 5.0); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t + (y + y)); tmp = 0.0; if (x <= -6e-5) tmp = t_1; elseif (x <= 1.75e-97) tmp = y * 5.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t + N[(y + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6e-5], t$95$1, If[LessEqual[x, 1.75e-97], N[(y * 5.0), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(t + \left(y + y\right)\right)\\
\mathbf{if}\;x \leq -6 \cdot 10^{-5}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.75 \cdot 10^{-97}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -6.00000000000000015e-5 or 1.7500000000000001e-97 < x Initial program 100.0%
Taylor expanded in x around inf
lower-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-+.f6497.0
Applied rewrites97.0%
Taylor expanded in z around 0
Applied rewrites67.8%
if -6.00000000000000015e-5 < x < 1.7500000000000001e-97Initial program 99.8%
Taylor expanded in x around 0
lower-*.f6467.4
Applied rewrites67.4%
Final simplification67.6%
(FPCore (x y z t) :precision binary64 (if (<= x -3.9e-7) (* x t) (if (<= x 8e-66) (* y 5.0) (* x t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.9e-7) {
tmp = x * t;
} else if (x <= 8e-66) {
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 <= (-3.9d-7)) then
tmp = x * t
else if (x <= 8d-66) 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 <= -3.9e-7) {
tmp = x * t;
} else if (x <= 8e-66) {
tmp = y * 5.0;
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3.9e-7: tmp = x * t elif x <= 8e-66: tmp = y * 5.0 else: tmp = x * t return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3.9e-7) tmp = Float64(x * t); elseif (x <= 8e-66) 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 <= -3.9e-7) tmp = x * t; elseif (x <= 8e-66) tmp = y * 5.0; else tmp = x * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.9e-7], N[(x * t), $MachinePrecision], If[LessEqual[x, 8e-66], N[(y * 5.0), $MachinePrecision], N[(x * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.9 \cdot 10^{-7}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 8 \cdot 10^{-66}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if x < -3.90000000000000025e-7 or 7.9999999999999998e-66 < x Initial program 100.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6440.7
Applied rewrites40.7%
if -3.90000000000000025e-7 < x < 7.9999999999999998e-66Initial program 99.8%
Taylor expanded in x around 0
lower-*.f6466.2
Applied rewrites66.2%
Final simplification51.5%
(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
lower-*.f6430.1
Applied rewrites30.1%
Final simplification30.1%
herbie shell --seed 2024221
(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)))