
(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 10 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 (* (fma (+ z y) 2.0 t) x)))
double code(double x, double y, double z, double t) {
return fma(y, 5.0, (fma((z + y), 2.0, t) * x));
}
function code(x, y, z, t) return fma(y, 5.0, Float64(fma(Float64(z + y), 2.0, t) * x)) end
code[x_, y_, z_, t_] := N[(y * 5.0 + N[(N[(N[(z + y), $MachinePrecision] * 2.0 + t), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, 5, \mathsf{fma}\left(z + y, 2, t\right) \cdot x\right)
\end{array}
Initial program 100.0%
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
lower-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
count-2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64100.0
lift-+.f64N/A
lift-fma.f64N/A
+-commutativeN/A
count-2N/A
associate-+l+N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
associate-+l+N/A
+-commutativeN/A
count-2N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64100.0
Applied rewrites100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (fma 2.0 x 5.0) y)) (t_2 (* (fma y 2.0 t) x)))
(if (<= t -5.4e+18)
t_2
(if (<= t -3.2e-161)
t_1
(if (<= t -8e-245) (* (* z x) 2.0) (if (<= t 0.062) t_1 t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = fma(2.0, x, 5.0) * y;
double t_2 = fma(y, 2.0, t) * x;
double tmp;
if (t <= -5.4e+18) {
tmp = t_2;
} else if (t <= -3.2e-161) {
tmp = t_1;
} else if (t <= -8e-245) {
tmp = (z * x) * 2.0;
} else if (t <= 0.062) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(fma(2.0, x, 5.0) * y) t_2 = Float64(fma(y, 2.0, t) * x) tmp = 0.0 if (t <= -5.4e+18) tmp = t_2; elseif (t <= -3.2e-161) tmp = t_1; elseif (t <= -8e-245) tmp = Float64(Float64(z * x) * 2.0); elseif (t <= 0.062) tmp = t_1; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(2.0 * x + 5.0), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y * 2.0 + t), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[t, -5.4e+18], t$95$2, If[LessEqual[t, -3.2e-161], t$95$1, If[LessEqual[t, -8e-245], N[(N[(z * x), $MachinePrecision] * 2.0), $MachinePrecision], If[LessEqual[t, 0.062], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(2, x, 5\right) \cdot y\\
t_2 := \mathsf{fma}\left(y, 2, t\right) \cdot x\\
\mathbf{if}\;t \leq -5.4 \cdot 10^{+18}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq -3.2 \cdot 10^{-161}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -8 \cdot 10^{-245}:\\
\;\;\;\;\left(z \cdot x\right) \cdot 2\\
\mathbf{elif}\;t \leq 0.062:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if t < -5.4e18 or 0.062 < t Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6483.8
Applied rewrites83.8%
Taylor expanded in z around 0
Applied rewrites72.6%
if -5.4e18 < t < -3.19999999999999985e-161 or -7.9999999999999994e-245 < t < 0.062Initial program 99.9%
Taylor expanded in y around inf
*-commutativeN/A
+-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
lower-fma.f6464.0
Applied rewrites64.0%
if -3.19999999999999985e-161 < t < -7.9999999999999994e-245Initial program 100.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6478.1
Applied rewrites78.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (fma (+ z y) 2.0 t) x)))
(if (<= x -135000000.0)
t_1
(if (<= x 0.00105) (fma y 5.0 (* (fma 2.0 z t) x)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma((z + y), 2.0, t) * x;
double tmp;
if (x <= -135000000.0) {
tmp = t_1;
} else if (x <= 0.00105) {
tmp = fma(y, 5.0, (fma(2.0, z, t) * x));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(fma(Float64(z + y), 2.0, t) * x) tmp = 0.0 if (x <= -135000000.0) tmp = t_1; elseif (x <= 0.00105) tmp = fma(y, 5.0, Float64(fma(2.0, z, t) * x)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(z + y), $MachinePrecision] * 2.0 + t), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -135000000.0], t$95$1, If[LessEqual[x, 0.00105], N[(y * 5.0 + N[(N[(2.0 * z + t), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(z + y, 2, t\right) \cdot x\\
\mathbf{if}\;x \leq -135000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 0.00105:\\
\;\;\;\;\mathsf{fma}\left(y, 5, \mathsf{fma}\left(2, z, t\right) \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.35e8 or 0.00104999999999999994 < x Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
if -1.35e8 < x < 0.00104999999999999994Initial program 99.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64100.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f64100.0
lift-+.f64N/A
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
count-2N/A
lower-fma.f6497.7
Applied rewrites97.7%
(FPCore (x y z t) :precision binary64 (if (<= t -5.4e+18) (* t x) (if (<= t -1e-81) (* 5.0 y) (if (<= t 3e+91) (* (* z x) 2.0) (* t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -5.4e+18) {
tmp = t * x;
} else if (t <= -1e-81) {
tmp = 5.0 * y;
} else if (t <= 3e+91) {
tmp = (z * x) * 2.0;
} else {
tmp = 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 (t <= (-5.4d+18)) then
tmp = t * x
else if (t <= (-1d-81)) then
tmp = 5.0d0 * y
else if (t <= 3d+91) then
tmp = (z * x) * 2.0d0
else
tmp = t * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -5.4e+18) {
tmp = t * x;
} else if (t <= -1e-81) {
tmp = 5.0 * y;
} else if (t <= 3e+91) {
tmp = (z * x) * 2.0;
} else {
tmp = t * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -5.4e+18: tmp = t * x elif t <= -1e-81: tmp = 5.0 * y elif t <= 3e+91: tmp = (z * x) * 2.0 else: tmp = t * x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -5.4e+18) tmp = Float64(t * x); elseif (t <= -1e-81) tmp = Float64(5.0 * y); elseif (t <= 3e+91) tmp = Float64(Float64(z * x) * 2.0); else tmp = Float64(t * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -5.4e+18) tmp = t * x; elseif (t <= -1e-81) tmp = 5.0 * y; elseif (t <= 3e+91) tmp = (z * x) * 2.0; else tmp = t * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -5.4e+18], N[(t * x), $MachinePrecision], If[LessEqual[t, -1e-81], N[(5.0 * y), $MachinePrecision], If[LessEqual[t, 3e+91], N[(N[(z * x), $MachinePrecision] * 2.0), $MachinePrecision], N[(t * x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.4 \cdot 10^{+18}:\\
\;\;\;\;t \cdot x\\
\mathbf{elif}\;t \leq -1 \cdot 10^{-81}:\\
\;\;\;\;5 \cdot y\\
\mathbf{elif}\;t \leq 3 \cdot 10^{+91}:\\
\;\;\;\;\left(z \cdot x\right) \cdot 2\\
\mathbf{else}:\\
\;\;\;\;t \cdot x\\
\end{array}
\end{array}
if t < -5.4e18 or 3.00000000000000006e91 < t Initial program 100.0%
Taylor expanded in t around inf
lower-*.f6466.4
Applied rewrites66.4%
if -5.4e18 < t < -9.9999999999999996e-82Initial program 100.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f6454.3
Applied rewrites54.3%
if -9.9999999999999996e-82 < t < 3.00000000000000006e91Initial program 99.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6443.0
Applied rewrites43.0%
Final simplification53.2%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (fma (+ z y) 2.0 t) x))) (if (<= x -0.56) t_1 (if (<= x 4e-31) (fma y 5.0 (* t x)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma((z + y), 2.0, t) * x;
double tmp;
if (x <= -0.56) {
tmp = t_1;
} else if (x <= 4e-31) {
tmp = fma(y, 5.0, (t * x));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(fma(Float64(z + y), 2.0, t) * x) tmp = 0.0 if (x <= -0.56) tmp = t_1; elseif (x <= 4e-31) tmp = fma(y, 5.0, Float64(t * x)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(z + y), $MachinePrecision] * 2.0 + t), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -0.56], t$95$1, If[LessEqual[x, 4e-31], N[(y * 5.0 + N[(t * x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(z + y, 2, t\right) \cdot x\\
\mathbf{if}\;x \leq -0.56:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 4 \cdot 10^{-31}:\\
\;\;\;\;\mathsf{fma}\left(y, 5, t \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -0.56000000000000005 or 4e-31 < x Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6499.3
Applied rewrites99.3%
if -0.56000000000000005 < x < 4e-31Initial program 99.9%
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
lower-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
count-2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64100.0
lift-+.f64N/A
lift-fma.f64N/A
+-commutativeN/A
count-2N/A
associate-+l+N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
associate-+l+N/A
+-commutativeN/A
count-2N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in t around inf
lower-*.f6476.1
Applied rewrites76.1%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (fma 2.0 x 5.0) y))) (if (<= y -2.8e+76) t_1 (if (<= y 6.5e-35) (* (fma z 2.0 t) x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma(2.0, x, 5.0) * y;
double tmp;
if (y <= -2.8e+76) {
tmp = t_1;
} else if (y <= 6.5e-35) {
tmp = fma(z, 2.0, t) * x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(fma(2.0, x, 5.0) * y) tmp = 0.0 if (y <= -2.8e+76) tmp = t_1; elseif (y <= 6.5e-35) tmp = Float64(fma(z, 2.0, t) * x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(2.0 * x + 5.0), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -2.8e+76], t$95$1, If[LessEqual[y, 6.5e-35], N[(N[(z * 2.0 + t), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(2, x, 5\right) \cdot y\\
\mathbf{if}\;y \leq -2.8 \cdot 10^{+76}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 6.5 \cdot 10^{-35}:\\
\;\;\;\;\mathsf{fma}\left(z, 2, t\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -2.7999999999999999e76 or 6.4999999999999999e-35 < y Initial program 99.9%
Taylor expanded in y around inf
*-commutativeN/A
+-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
lower-fma.f6480.3
Applied rewrites80.3%
if -2.7999999999999999e76 < y < 6.4999999999999999e-35Initial program 100.0%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6481.5
Applied rewrites81.5%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (fma y 2.0 t) x))) (if (<= x -2.3e-80) t_1 (if (<= x 7.5e-40) (* 5.0 y) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma(y, 2.0, t) * x;
double tmp;
if (x <= -2.3e-80) {
tmp = t_1;
} else if (x <= 7.5e-40) {
tmp = 5.0 * y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(fma(y, 2.0, t) * x) tmp = 0.0 if (x <= -2.3e-80) tmp = t_1; elseif (x <= 7.5e-40) tmp = Float64(5.0 * y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y * 2.0 + t), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -2.3e-80], t$95$1, If[LessEqual[x, 7.5e-40], N[(5.0 * y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, 2, t\right) \cdot x\\
\mathbf{if}\;x \leq -2.3 \cdot 10^{-80}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{-40}:\\
\;\;\;\;5 \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -2.2999999999999998e-80 or 7.50000000000000069e-40 < x Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6495.6
Applied rewrites95.6%
Taylor expanded in z around 0
Applied rewrites69.1%
if -2.2999999999999998e-80 < x < 7.50000000000000069e-40Initial program 100.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f6457.0
Applied rewrites57.0%
Final simplification64.5%
(FPCore (x y z t) :precision binary64 (if (<= x -200000000000.0) (* (* 2.0 y) x) (if (<= x 7.5e-40) (* 5.0 y) (* t x))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -200000000000.0) {
tmp = (2.0 * y) * x;
} else if (x <= 7.5e-40) {
tmp = 5.0 * y;
} else {
tmp = 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 <= (-200000000000.0d0)) then
tmp = (2.0d0 * y) * x
else if (x <= 7.5d-40) then
tmp = 5.0d0 * y
else
tmp = t * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -200000000000.0) {
tmp = (2.0 * y) * x;
} else if (x <= 7.5e-40) {
tmp = 5.0 * y;
} else {
tmp = t * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -200000000000.0: tmp = (2.0 * y) * x elif x <= 7.5e-40: tmp = 5.0 * y else: tmp = t * x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -200000000000.0) tmp = Float64(Float64(2.0 * y) * x); elseif (x <= 7.5e-40) tmp = Float64(5.0 * y); else tmp = Float64(t * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -200000000000.0) tmp = (2.0 * y) * x; elseif (x <= 7.5e-40) tmp = 5.0 * y; else tmp = t * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -200000000000.0], N[(N[(2.0 * y), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[x, 7.5e-40], N[(5.0 * y), $MachinePrecision], N[(t * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -200000000000:\\
\;\;\;\;\left(2 \cdot y\right) \cdot x\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{-40}:\\
\;\;\;\;5 \cdot y\\
\mathbf{else}:\\
\;\;\;\;t \cdot x\\
\end{array}
\end{array}
if x < -2e11Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in y around inf
Applied rewrites48.6%
if -2e11 < x < 7.50000000000000069e-40Initial program 99.9%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f6452.6
Applied rewrites52.6%
if 7.50000000000000069e-40 < x Initial program 100.0%
Taylor expanded in t around inf
lower-*.f6446.9
Applied rewrites46.9%
Final simplification49.8%
(FPCore (x y z t) :precision binary64 (if (<= x -2.3e-80) (* t x) (if (<= x 7.5e-40) (* 5.0 y) (* t x))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.3e-80) {
tmp = t * x;
} else if (x <= 7.5e-40) {
tmp = 5.0 * y;
} else {
tmp = 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 <= (-2.3d-80)) then
tmp = t * x
else if (x <= 7.5d-40) then
tmp = 5.0d0 * y
else
tmp = t * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.3e-80) {
tmp = t * x;
} else if (x <= 7.5e-40) {
tmp = 5.0 * y;
} else {
tmp = t * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.3e-80: tmp = t * x elif x <= 7.5e-40: tmp = 5.0 * y else: tmp = t * x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.3e-80) tmp = Float64(t * x); elseif (x <= 7.5e-40) tmp = Float64(5.0 * y); else tmp = Float64(t * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2.3e-80) tmp = t * x; elseif (x <= 7.5e-40) tmp = 5.0 * y; else tmp = t * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.3e-80], N[(t * x), $MachinePrecision], If[LessEqual[x, 7.5e-40], N[(5.0 * y), $MachinePrecision], N[(t * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.3 \cdot 10^{-80}:\\
\;\;\;\;t \cdot x\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{-40}:\\
\;\;\;\;5 \cdot y\\
\mathbf{else}:\\
\;\;\;\;t \cdot x\\
\end{array}
\end{array}
if x < -2.2999999999999998e-80 or 7.50000000000000069e-40 < x Initial program 100.0%
Taylor expanded in t around inf
lower-*.f6437.5
Applied rewrites37.5%
if -2.2999999999999998e-80 < x < 7.50000000000000069e-40Initial program 100.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f6457.0
Applied rewrites57.0%
Final simplification45.0%
(FPCore (x y z t) :precision binary64 (* t x))
double code(double x, double y, double z, double t) {
return 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 = t * x
end function
public static double code(double x, double y, double z, double t) {
return t * x;
}
def code(x, y, z, t): return t * x
function code(x, y, z, t) return Float64(t * x) end
function tmp = code(x, y, z, t) tmp = t * x; end
code[x_, y_, z_, t_] := N[(t * x), $MachinePrecision]
\begin{array}{l}
\\
t \cdot x
\end{array}
Initial program 100.0%
Taylor expanded in t around inf
lower-*.f6431.8
Applied rewrites31.8%
herbie shell --seed 2024249
(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)))