
(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.5%
Final simplification99.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ z z))))
(if (<= z -2.4e+75)
t_1
(if (<= z -1.08e-128)
(* x t)
(if (<= z 6.1e-183) (* y 5.0) (if (<= z 6e+69) (* x t) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (z + z);
double tmp;
if (z <= -2.4e+75) {
tmp = t_1;
} else if (z <= -1.08e-128) {
tmp = x * t;
} else if (z <= 6.1e-183) {
tmp = y * 5.0;
} else if (z <= 6e+69) {
tmp = x * t;
} 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 (z <= (-2.4d+75)) then
tmp = t_1
else if (z <= (-1.08d-128)) then
tmp = x * t
else if (z <= 6.1d-183) then
tmp = y * 5.0d0
else if (z <= 6d+69) then
tmp = x * t
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 (z <= -2.4e+75) {
tmp = t_1;
} else if (z <= -1.08e-128) {
tmp = x * t;
} else if (z <= 6.1e-183) {
tmp = y * 5.0;
} else if (z <= 6e+69) {
tmp = x * t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (z + z) tmp = 0 if z <= -2.4e+75: tmp = t_1 elif z <= -1.08e-128: tmp = x * t elif z <= 6.1e-183: tmp = y * 5.0 elif z <= 6e+69: tmp = x * t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(z + z)) tmp = 0.0 if (z <= -2.4e+75) tmp = t_1; elseif (z <= -1.08e-128) tmp = Float64(x * t); elseif (z <= 6.1e-183) tmp = Float64(y * 5.0); elseif (z <= 6e+69) tmp = Float64(x * t); 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 (z <= -2.4e+75) tmp = t_1; elseif (z <= -1.08e-128) tmp = x * t; elseif (z <= 6.1e-183) tmp = y * 5.0; elseif (z <= 6e+69) tmp = x * t; 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[z, -2.4e+75], t$95$1, If[LessEqual[z, -1.08e-128], N[(x * t), $MachinePrecision], If[LessEqual[z, 6.1e-183], N[(y * 5.0), $MachinePrecision], If[LessEqual[z, 6e+69], N[(x * t), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(z + z\right)\\
\mathbf{if}\;z \leq -2.4 \cdot 10^{+75}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.08 \cdot 10^{-128}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;z \leq 6.1 \cdot 10^{-183}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;z \leq 6 \cdot 10^{+69}:\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.4e75 or 5.99999999999999967e69 < z Initial program 100.0%
Taylor expanded in z around inf
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f6460.5
Simplified60.5%
count-2N/A
*-commutativeN/A
*-lowering-*.f64N/A
+-lowering-+.f6460.5
Applied egg-rr60.5%
if -2.4e75 < z < -1.08e-128 or 6.1000000000000002e-183 < z < 5.99999999999999967e69Initial program 98.9%
Taylor expanded in t around inf
*-commutativeN/A
*-lowering-*.f6449.4
Simplified49.4%
if -1.08e-128 < z < 6.1000000000000002e-183Initial program 99.8%
Taylor expanded in x around 0
*-lowering-*.f6441.8
Simplified41.8%
Final simplification51.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (fma 2.0 (+ y z) t))))
(if (<= x -122.0)
t_1
(if (<= x 4.5e-8) (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 <= -122.0) {
tmp = t_1;
} else if (x <= 4.5e-8) {
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 <= -122.0) tmp = t_1; elseif (x <= 4.5e-8) 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, -122.0], t$95$1, If[LessEqual[x, 4.5e-8], 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 -122:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{-8}:\\
\;\;\;\;\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 < -122 or 4.49999999999999993e-8 < x Initial program 99.2%
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 -122 < x < 4.49999999999999993e-8Initial 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.1
Applied egg-rr99.1%
Final simplification99.1%
(FPCore (x y z t)
:precision binary64
(if (<= z -4.5e+57)
(* x (fma 2.0 (+ y z) t))
(if (<= z 9.2e+139)
(fma x (fma y 2.0 t) (* y 5.0))
(fma (+ z z) x (* y 5.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.5e+57) {
tmp = x * fma(2.0, (y + z), t);
} else if (z <= 9.2e+139) {
tmp = fma(x, fma(y, 2.0, t), (y * 5.0));
} else {
tmp = fma((z + z), x, (y * 5.0));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -4.5e+57) tmp = Float64(x * fma(2.0, Float64(y + z), t)); elseif (z <= 9.2e+139) tmp = fma(x, fma(y, 2.0, t), Float64(y * 5.0)); else tmp = fma(Float64(z + z), x, Float64(y * 5.0)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -4.5e+57], N[(x * N[(2.0 * N[(y + z), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9.2e+139], N[(x * N[(y * 2.0 + t), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision], N[(N[(z + z), $MachinePrecision] * x + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.5 \cdot 10^{+57}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(2, y + z, t\right)\\
\mathbf{elif}\;z \leq 9.2 \cdot 10^{+139}:\\
\;\;\;\;\mathsf{fma}\left(x, \mathsf{fma}\left(y, 2, t\right), y \cdot 5\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z + z, x, y \cdot 5\right)\\
\end{array}
\end{array}
if z < -4.49999999999999996e57Initial program 99.9%
Taylor expanded in x around inf
*-lowering-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
accelerator-lowering-fma.f64N/A
+-lowering-+.f6483.9
Simplified83.9%
if -4.49999999999999996e57 < z < 9.2e139Initial program 99.3%
Taylor expanded in z around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6493.4
Simplified93.4%
if 9.2e139 < z Initial 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-+.f6494.5
Applied egg-rr94.5%
Taylor expanded in t around 0
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-rgt-identityN/A
associate-*r*N/A
*-inversesN/A
associate-/l*N/A
associate-*l/N/A
associate-*r/N/A
associate-*l*N/A
metadata-evalN/A
distribute-lft-neg-inN/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-neg-inN/A
metadata-evalN/A
associate-*l*N/A
associate-*r/N/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
Simplified93.1%
count-2N/A
*-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f6493.1
Applied egg-rr93.1%
Final simplification91.3%
(FPCore (x y z t)
:precision binary64
(if (<= y -1.8e-11)
(* x (fma 2.0 y t))
(if (<= y 1.12e+140)
(* x (fma 2.0 z t))
(if (<= y 4.2e+294) (* y 5.0) (* y (* x 2.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.8e-11) {
tmp = x * fma(2.0, y, t);
} else if (y <= 1.12e+140) {
tmp = x * fma(2.0, z, t);
} else if (y <= 4.2e+294) {
tmp = y * 5.0;
} else {
tmp = y * (x * 2.0);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= -1.8e-11) tmp = Float64(x * fma(2.0, y, t)); elseif (y <= 1.12e+140) tmp = Float64(x * fma(2.0, z, t)); elseif (y <= 4.2e+294) tmp = Float64(y * 5.0); else tmp = Float64(y * Float64(x * 2.0)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.8e-11], N[(x * N[(2.0 * y + t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.12e+140], N[(x * N[(2.0 * z + t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.2e+294], N[(y * 5.0), $MachinePrecision], N[(y * N[(x * 2.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.8 \cdot 10^{-11}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(2, y, t\right)\\
\mathbf{elif}\;y \leq 1.12 \cdot 10^{+140}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(2, z, t\right)\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{+294}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x \cdot 2\right)\\
\end{array}
\end{array}
if y < -1.79999999999999992e-11Initial program 99.9%
Taylor expanded in x around inf
*-lowering-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
accelerator-lowering-fma.f64N/A
+-lowering-+.f6463.9
Simplified63.9%
Taylor expanded in z around 0
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6459.6
Simplified59.6%
if -1.79999999999999992e-11 < y < 1.1199999999999999e140Initial program 100.0%
Taylor expanded in y around 0
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6477.1
Simplified77.1%
if 1.1199999999999999e140 < y < 4.2e294Initial program 99.8%
Taylor expanded in x around 0
*-lowering-*.f6460.1
Simplified60.1%
if 4.2e294 < y Initial program 83.3%
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.f64100.0
Simplified100.0%
Taylor expanded in x around inf
*-commutativeN/A
*-lowering-*.f64100.0
Simplified100.0%
Final simplification70.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (* x 2.0))))
(if (<= x -1.35e+272)
(* x (+ z z))
(if (<= x -122.0) t_1 (if (<= x 4.5e-8) (* y 5.0) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = y * (x * 2.0);
double tmp;
if (x <= -1.35e+272) {
tmp = x * (z + z);
} else if (x <= -122.0) {
tmp = t_1;
} else if (x <= 4.5e-8) {
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 = y * (x * 2.0d0)
if (x <= (-1.35d+272)) then
tmp = x * (z + z)
else if (x <= (-122.0d0)) then
tmp = t_1
else if (x <= 4.5d-8) 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 = y * (x * 2.0);
double tmp;
if (x <= -1.35e+272) {
tmp = x * (z + z);
} else if (x <= -122.0) {
tmp = t_1;
} else if (x <= 4.5e-8) {
tmp = y * 5.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (x * 2.0) tmp = 0 if x <= -1.35e+272: tmp = x * (z + z) elif x <= -122.0: tmp = t_1 elif x <= 4.5e-8: tmp = y * 5.0 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(x * 2.0)) tmp = 0.0 if (x <= -1.35e+272) tmp = Float64(x * Float64(z + z)); elseif (x <= -122.0) tmp = t_1; elseif (x <= 4.5e-8) tmp = Float64(y * 5.0); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (x * 2.0); tmp = 0.0; if (x <= -1.35e+272) tmp = x * (z + z); elseif (x <= -122.0) tmp = t_1; elseif (x <= 4.5e-8) tmp = y * 5.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(x * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.35e+272], N[(x * N[(z + z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -122.0], t$95$1, If[LessEqual[x, 4.5e-8], N[(y * 5.0), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(x \cdot 2\right)\\
\mathbf{if}\;x \leq -1.35 \cdot 10^{+272}:\\
\;\;\;\;x \cdot \left(z + z\right)\\
\mathbf{elif}\;x \leq -122:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{-8}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.35000000000000006e272Initial program 100.0%
Taylor expanded in z around inf
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f6464.0
Simplified64.0%
count-2N/A
*-commutativeN/A
*-lowering-*.f64N/A
+-lowering-+.f6464.0
Applied egg-rr64.0%
if -1.35000000000000006e272 < x < -122 or 4.49999999999999993e-8 < x Initial program 99.2%
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.f6450.4
Simplified50.4%
Taylor expanded in x around inf
*-commutativeN/A
*-lowering-*.f6449.5
Simplified49.5%
if -122 < x < 4.49999999999999993e-8Initial program 99.9%
Taylor expanded in x around 0
*-lowering-*.f6455.0
Simplified55.0%
Final simplification52.8%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (fma 2.0 (+ y z) t)))) (if (<= x -1.85e-19) t_1 (if (<= x 1.6e-8) (fma (+ z z) x (* y 5.0)) 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.85e-19) {
tmp = t_1;
} else if (x <= 1.6e-8) {
tmp = fma((z + z), x, (y * 5.0));
} 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.85e-19) tmp = t_1; elseif (x <= 1.6e-8) tmp = fma(Float64(z + z), x, 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 * N[(y + z), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.85e-19], t$95$1, If[LessEqual[x, 1.6e-8], N[(N[(z + z), $MachinePrecision] * x + N[(y * 5.0), $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.85 \cdot 10^{-19}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.6 \cdot 10^{-8}:\\
\;\;\;\;\mathsf{fma}\left(z + z, x, y \cdot 5\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.85000000000000003e-19 or 1.6000000000000001e-8 < x Initial program 99.2%
Taylor expanded in x around inf
*-lowering-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
accelerator-lowering-fma.f64N/A
+-lowering-+.f6498.4
Simplified98.4%
if -1.85000000000000003e-19 < x < 1.6000000000000001e-8Initial 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.6
Applied egg-rr99.6%
Taylor expanded in t around 0
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-rgt-identityN/A
associate-*r*N/A
*-inversesN/A
associate-/l*N/A
associate-*l/N/A
associate-*r/N/A
associate-*l*N/A
metadata-evalN/A
distribute-lft-neg-inN/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-neg-inN/A
metadata-evalN/A
associate-*l*N/A
associate-*r/N/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
Simplified79.3%
count-2N/A
*-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f6479.3
Applied egg-rr79.3%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (fma 2.0 (+ y z) t)))) (if (<= x -1.12e-35) t_1 (if (<= x 1.25e-20) (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 <= -1.12e-35) {
tmp = t_1;
} else if (x <= 1.25e-20) {
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 <= -1.12e-35) tmp = t_1; elseif (x <= 1.25e-20) 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, -1.12e-35], t$95$1, If[LessEqual[x, 1.25e-20], 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 -1.12 \cdot 10^{-35}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.25 \cdot 10^{-20}:\\
\;\;\;\;\mathsf{fma}\left(y, 5, x \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.12e-35 or 1.25e-20 < x Initial program 99.3%
Taylor expanded in x around inf
*-lowering-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
accelerator-lowering-fma.f64N/A
+-lowering-+.f6497.2
Simplified97.2%
if -1.12e-35 < x < 1.25e-20Initial 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-*.f6478.6
Simplified78.6%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* y (fma x 2.0 5.0)))) (if (<= y -8e+37) t_1 (if (<= y 3e+68) (* 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 <= -8e+37) {
tmp = t_1;
} else if (y <= 3e+68) {
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 <= -8e+37) tmp = t_1; elseif (y <= 3e+68) 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, -8e+37], t$95$1, If[LessEqual[y, 3e+68], 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 -8 \cdot 10^{+37}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 3 \cdot 10^{+68}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(2, z, t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -7.99999999999999963e37 or 3.0000000000000002e68 < y Initial program 99.1%
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.f6487.0
Simplified87.0%
if -7.99999999999999963e37 < y < 3.0000000000000002e68Initial program 100.0%
Taylor expanded in y around 0
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6481.5
Simplified81.5%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (fma 2.0 y t)))) (if (<= x -3.1e-28) t_1 (if (<= x 1.6e-8) (* y 5.0) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * fma(2.0, y, t);
double tmp;
if (x <= -3.1e-28) {
tmp = t_1;
} else if (x <= 1.6e-8) {
tmp = y * 5.0;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(x * fma(2.0, y, t)) tmp = 0.0 if (x <= -3.1e-28) tmp = t_1; elseif (x <= 1.6e-8) 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 * y + t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.1e-28], t$95$1, If[LessEqual[x, 1.6e-8], N[(y * 5.0), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \mathsf{fma}\left(2, y, t\right)\\
\mathbf{if}\;x \leq -3.1 \cdot 10^{-28}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.6 \cdot 10^{-8}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -3.09999999999999992e-28 or 1.6000000000000001e-8 < x Initial program 99.3%
Taylor expanded in x around inf
*-lowering-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
accelerator-lowering-fma.f64N/A
+-lowering-+.f6498.4
Simplified98.4%
Taylor expanded in z around 0
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6474.9
Simplified74.9%
if -3.09999999999999992e-28 < x < 1.6000000000000001e-8Initial program 99.9%
Taylor expanded in x around 0
*-lowering-*.f6457.4
Simplified57.4%
Final simplification66.8%
(FPCore (x y z t) :precision binary64 (if (<= x -2.2e-28) (* x t) (if (<= x 1.75e-8) (* y 5.0) (* x t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.2e-28) {
tmp = x * t;
} else if (x <= 1.75e-8) {
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.2d-28)) then
tmp = x * t
else if (x <= 1.75d-8) 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.2e-28) {
tmp = x * t;
} else if (x <= 1.75e-8) {
tmp = y * 5.0;
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.2e-28: tmp = x * t elif x <= 1.75e-8: tmp = y * 5.0 else: tmp = x * t return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.2e-28) tmp = Float64(x * t); elseif (x <= 1.75e-8) 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.2e-28) tmp = x * t; elseif (x <= 1.75e-8) tmp = y * 5.0; else tmp = x * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.2e-28], N[(x * t), $MachinePrecision], If[LessEqual[x, 1.75e-8], N[(y * 5.0), $MachinePrecision], N[(x * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.2 \cdot 10^{-28}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 1.75 \cdot 10^{-8}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if x < -2.19999999999999996e-28 or 1.75000000000000012e-8 < x Initial program 99.3%
Taylor expanded in t around inf
*-commutativeN/A
*-lowering-*.f6436.7
Simplified36.7%
if -2.19999999999999996e-28 < x < 1.75000000000000012e-8Initial program 99.9%
Taylor expanded in x around 0
*-lowering-*.f6457.4
Simplified57.4%
Final simplification46.3%
(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.5%
Taylor expanded in x around 0
*-lowering-*.f6428.3
Simplified28.3%
Final simplification28.3%
herbie shell --seed 2024198
(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)))