
(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 11 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 (* x (+ z z))))
(if (<= x -2.8e+236)
t_1
(if (<= x -2.3e-10)
(* x t)
(if (<= x 2.05e-28)
(* y 5.0)
(if (<= x 1.5e+107) t_1 (* y (* x 2.0))))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (z + z);
double tmp;
if (x <= -2.8e+236) {
tmp = t_1;
} else if (x <= -2.3e-10) {
tmp = x * t;
} else if (x <= 2.05e-28) {
tmp = y * 5.0;
} else if (x <= 1.5e+107) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = x * (z + z)
if (x <= (-2.8d+236)) then
tmp = t_1
else if (x <= (-2.3d-10)) then
tmp = x * t
else if (x <= 2.05d-28) then
tmp = y * 5.0d0
else if (x <= 1.5d+107) then
tmp = t_1
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 t_1 = x * (z + z);
double tmp;
if (x <= -2.8e+236) {
tmp = t_1;
} else if (x <= -2.3e-10) {
tmp = x * t;
} else if (x <= 2.05e-28) {
tmp = y * 5.0;
} else if (x <= 1.5e+107) {
tmp = t_1;
} else {
tmp = y * (x * 2.0);
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (z + z) tmp = 0 if x <= -2.8e+236: tmp = t_1 elif x <= -2.3e-10: tmp = x * t elif x <= 2.05e-28: tmp = y * 5.0 elif x <= 1.5e+107: tmp = t_1 else: tmp = y * (x * 2.0) return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(z + z)) tmp = 0.0 if (x <= -2.8e+236) tmp = t_1; elseif (x <= -2.3e-10) tmp = Float64(x * t); elseif (x <= 2.05e-28) tmp = Float64(y * 5.0); elseif (x <= 1.5e+107) tmp = t_1; else tmp = Float64(y * Float64(x * 2.0)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (z + z); tmp = 0.0; if (x <= -2.8e+236) tmp = t_1; elseif (x <= -2.3e-10) tmp = x * t; elseif (x <= 2.05e-28) tmp = y * 5.0; elseif (x <= 1.5e+107) tmp = t_1; else tmp = y * (x * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(z + z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.8e+236], t$95$1, If[LessEqual[x, -2.3e-10], N[(x * t), $MachinePrecision], If[LessEqual[x, 2.05e-28], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 1.5e+107], t$95$1, N[(y * N[(x * 2.0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(z + z\right)\\
\mathbf{if}\;x \leq -2.8 \cdot 10^{+236}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -2.3 \cdot 10^{-10}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 2.05 \cdot 10^{-28}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 1.5 \cdot 10^{+107}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x \cdot 2\right)\\
\end{array}
\end{array}
if x < -2.79999999999999992e236 or 2.0500000000000001e-28 < x < 1.50000000000000012e107Initial program 100.0%
Taylor expanded in z around inf
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6459.0
Simplified59.0%
count-2N/A
lift-+.f64N/A
*-commutativeN/A
lower-*.f6459.0
Applied egg-rr59.0%
if -2.79999999999999992e236 < x < -2.30000000000000007e-10Initial program 100.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6443.6
Simplified43.6%
if -2.30000000000000007e-10 < x < 2.0500000000000001e-28Initial program 99.8%
Taylor expanded in x around 0
lower-*.f6464.8
Simplified64.8%
if 1.50000000000000012e107 < 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
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.f6457.0
Simplified57.0%
Taylor expanded in x around inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6457.0
Simplified57.0%
Final simplification57.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (fma y 2.0 t))))
(if (<= x -1.28e+244)
(* x (+ z z))
(if (<= x -22.0) t_1 (if (<= x 31000000000.0) (fma y 5.0 (* x t)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * fma(y, 2.0, t);
double tmp;
if (x <= -1.28e+244) {
tmp = x * (z + z);
} else if (x <= -22.0) {
tmp = t_1;
} else if (x <= 31000000000.0) {
tmp = fma(y, 5.0, (x * t));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(x * fma(y, 2.0, t)) tmp = 0.0 if (x <= -1.28e+244) tmp = Float64(x * Float64(z + z)); elseif (x <= -22.0) tmp = t_1; elseif (x <= 31000000000.0) 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[(y * 2.0 + t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.28e+244], N[(x * N[(z + z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -22.0], t$95$1, If[LessEqual[x, 31000000000.0], 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(y, 2, t\right)\\
\mathbf{if}\;x \leq -1.28 \cdot 10^{+244}:\\
\;\;\;\;x \cdot \left(z + z\right)\\
\mathbf{elif}\;x \leq -22:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 31000000000:\\
\;\;\;\;\mathsf{fma}\left(y, 5, x \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.28000000000000007e244Initial program 100.0%
Taylor expanded in z around inf
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6480.1
Simplified80.1%
count-2N/A
lift-+.f64N/A
*-commutativeN/A
lower-*.f6480.1
Applied egg-rr80.1%
if -1.28000000000000007e244 < x < -22 or 3.1e10 < 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.5
Simplified99.5%
Taylor expanded in z around 0
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6469.9
Simplified69.9%
if -22 < x < 3.1e10Initial program 99.9%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6481.3
Simplified81.3%
lift-*.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6481.4
Applied egg-rr81.4%
Final simplification76.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (fma x 2.0 5.0))))
(if (<= y -1.55e+29)
t_1
(if (<= y 1.5e-176)
(* x (+ z z))
(if (<= y 6e+34) (* x (fma y 2.0 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 <= -1.55e+29) {
tmp = t_1;
} else if (y <= 1.5e-176) {
tmp = x * (z + z);
} else if (y <= 6e+34) {
tmp = x * fma(y, 2.0, 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 <= -1.55e+29) tmp = t_1; elseif (y <= 1.5e-176) tmp = Float64(x * Float64(z + z)); elseif (y <= 6e+34) tmp = Float64(x * fma(y, 2.0, 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, -1.55e+29], t$95$1, If[LessEqual[y, 1.5e-176], N[(x * N[(z + z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6e+34], N[(x * N[(y * 2.0 + 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 -1.55 \cdot 10^{+29}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.5 \cdot 10^{-176}:\\
\;\;\;\;x \cdot \left(z + z\right)\\
\mathbf{elif}\;y \leq 6 \cdot 10^{+34}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(y, 2, t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.5499999999999999e29 or 6.00000000000000037e34 < 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.f6484.2
Simplified84.2%
if -1.5499999999999999e29 < y < 1.5e-176Initial program 100.0%
Taylor expanded in z around inf
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6453.2
Simplified53.2%
count-2N/A
lift-+.f64N/A
*-commutativeN/A
lower-*.f6453.2
Applied egg-rr53.2%
if 1.5e-176 < y < 6.00000000000000037e34Initial program 99.9%
Taylor expanded in x around inf
lower-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-+.f6482.3
Simplified82.3%
Taylor expanded in z around 0
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6463.0
Simplified63.0%
Final simplification69.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (fma y 2.0 t))))
(if (<= x -6.4e+243)
(* x (+ z z))
(if (<= x -3.65e-10) t_1 (if (<= x 1.02e-28) (* y 5.0) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * fma(y, 2.0, t);
double tmp;
if (x <= -6.4e+243) {
tmp = x * (z + z);
} else if (x <= -3.65e-10) {
tmp = t_1;
} else if (x <= 1.02e-28) {
tmp = y * 5.0;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(x * fma(y, 2.0, t)) tmp = 0.0 if (x <= -6.4e+243) tmp = Float64(x * Float64(z + z)); elseif (x <= -3.65e-10) tmp = t_1; elseif (x <= 1.02e-28) 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[(y * 2.0 + t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6.4e+243], N[(x * N[(z + z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -3.65e-10], t$95$1, If[LessEqual[x, 1.02e-28], N[(y * 5.0), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \mathsf{fma}\left(y, 2, t\right)\\
\mathbf{if}\;x \leq -6.4 \cdot 10^{+243}:\\
\;\;\;\;x \cdot \left(z + z\right)\\
\mathbf{elif}\;x \leq -3.65 \cdot 10^{-10}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.02 \cdot 10^{-28}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -6.40000000000000033e243Initial program 100.0%
Taylor expanded in z around inf
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6480.1
Simplified80.1%
count-2N/A
lift-+.f64N/A
*-commutativeN/A
lower-*.f6480.1
Applied egg-rr80.1%
if -6.40000000000000033e243 < x < -3.6499999999999998e-10 or 1.01999999999999997e-28 < 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.8
Simplified97.8%
Taylor expanded in z around 0
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6468.2
Simplified68.2%
if -3.6499999999999998e-10 < x < 1.01999999999999997e-28Initial program 99.8%
Taylor expanded in x around 0
lower-*.f6464.8
Simplified64.8%
Final simplification67.0%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (fma 2.0 (+ y z) t)))) (if (<= x -22.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 <= -22.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 <= -22.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, -22.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 -22:\\
\;\;\;\;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 < -22 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.5
Simplified99.5%
if -22 < x < 2.5Initial program 99.9%
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64100.0
Applied egg-rr99.0%
Final simplification99.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ z z))))
(if (<= x -3.35e+236)
t_1
(if (<= x -1.25e-9) (* x t) (if (<= x 8.5e-29) (* y 5.0) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * (z + z);
double tmp;
if (x <= -3.35e+236) {
tmp = t_1;
} else if (x <= -1.25e-9) {
tmp = x * t;
} else if (x <= 8.5e-29) {
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 * (z + z)
if (x <= (-3.35d+236)) then
tmp = t_1
else if (x <= (-1.25d-9)) then
tmp = x * t
else if (x <= 8.5d-29) 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 * (z + z);
double tmp;
if (x <= -3.35e+236) {
tmp = t_1;
} else if (x <= -1.25e-9) {
tmp = x * t;
} else if (x <= 8.5e-29) {
tmp = y * 5.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (z + z) tmp = 0 if x <= -3.35e+236: tmp = t_1 elif x <= -1.25e-9: tmp = x * t elif x <= 8.5e-29: tmp = y * 5.0 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(z + z)) tmp = 0.0 if (x <= -3.35e+236) tmp = t_1; elseif (x <= -1.25e-9) tmp = Float64(x * t); elseif (x <= 8.5e-29) tmp = Float64(y * 5.0); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (z + z); tmp = 0.0; if (x <= -3.35e+236) tmp = t_1; elseif (x <= -1.25e-9) tmp = x * t; elseif (x <= 8.5e-29) 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[(z + z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.35e+236], t$95$1, If[LessEqual[x, -1.25e-9], N[(x * t), $MachinePrecision], If[LessEqual[x, 8.5e-29], N[(y * 5.0), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(z + z\right)\\
\mathbf{if}\;x \leq -3.35 \cdot 10^{+236}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -1.25 \cdot 10^{-9}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 8.5 \cdot 10^{-29}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -3.3500000000000002e236 or 8.5000000000000001e-29 < x Initial program 100.0%
Taylor expanded in z around inf
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6447.6
Simplified47.6%
count-2N/A
lift-+.f64N/A
*-commutativeN/A
lower-*.f6447.6
Applied egg-rr47.6%
if -3.3500000000000002e236 < x < -1.25e-9Initial program 100.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6443.6
Simplified43.6%
if -1.25e-9 < x < 8.5000000000000001e-29Initial program 99.8%
Taylor expanded in x around 0
lower-*.f6464.8
Simplified64.8%
Final simplification54.9%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (fma 2.0 (+ y z) t)))) (if (<= x -22.0) t_1 (if (<= x 1.55e-28) (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 <= -22.0) {
tmp = t_1;
} else if (x <= 1.55e-28) {
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 <= -22.0) tmp = t_1; elseif (x <= 1.55e-28) 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, -22.0], t$95$1, If[LessEqual[x, 1.55e-28], 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 -22:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{-28}:\\
\;\;\;\;\mathsf{fma}\left(y, 5, x \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -22 or 1.54999999999999996e-28 < 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-+.f6498.2
Simplified98.2%
if -22 < x < 1.54999999999999996e-28Initial program 99.9%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6484.0
Simplified84.0%
lift-*.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6484.0
Applied egg-rr84.0%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (* (+ y z) 2.0)))) (if (<= x -9500.0) t_1 (if (<= x 1040000000.0) (fma y 5.0 (* x t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * ((y + z) * 2.0);
double tmp;
if (x <= -9500.0) {
tmp = t_1;
} else if (x <= 1040000000.0) {
tmp = fma(y, 5.0, (x * t));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(x * Float64(Float64(y + z) * 2.0)) tmp = 0.0 if (x <= -9500.0) tmp = t_1; elseif (x <= 1040000000.0) 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[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -9500.0], t$95$1, If[LessEqual[x, 1040000000.0], N[(y * 5.0 + N[(x * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(\left(y + z\right) \cdot 2\right)\\
\mathbf{if}\;x \leq -9500:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1040000000:\\
\;\;\;\;\mathsf{fma}\left(y, 5, x \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -9500 or 1.04e9 < 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.5
Simplified99.5%
Taylor expanded in t around 0
lower-*.f64N/A
lower-+.f6476.2
Simplified76.2%
if -9500 < x < 1.04e9Initial program 99.9%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6482.5
Simplified82.5%
lift-*.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6482.6
Applied egg-rr82.6%
Final simplification79.5%
(FPCore (x y z t) :precision binary64 (if (<= x -2.35e-11) (* x t) (if (<= x 6.9e-28) (* y 5.0) (* x t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.35e-11) {
tmp = x * t;
} else if (x <= 6.9e-28) {
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 <= (-2.35d-11)) then
tmp = x * t
else if (x <= 6.9d-28) 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 <= -2.35e-11) {
tmp = x * t;
} else if (x <= 6.9e-28) {
tmp = y * 5.0;
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.35e-11: tmp = x * t elif x <= 6.9e-28: tmp = y * 5.0 else: tmp = x * t return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.35e-11) tmp = Float64(x * t); elseif (x <= 6.9e-28) 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 <= -2.35e-11) tmp = x * t; elseif (x <= 6.9e-28) tmp = y * 5.0; else tmp = x * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.35e-11], N[(x * t), $MachinePrecision], If[LessEqual[x, 6.9e-28], N[(y * 5.0), $MachinePrecision], N[(x * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.35 \cdot 10^{-11}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 6.9 \cdot 10^{-28}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if x < -2.34999999999999996e-11 or 6.90000000000000001e-28 < x Initial program 100.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6435.7
Simplified35.7%
if -2.34999999999999996e-11 < x < 6.90000000000000001e-28Initial program 99.8%
Taylor expanded in x around 0
lower-*.f6464.8
Simplified64.8%
Final simplification49.7%
(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-*.f6432.9
Simplified32.9%
Final simplification32.9%
herbie shell --seed 2024207
(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)))