
(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 (fma y 5.0 (* x (fma (+ y z) 2.0 t))))
double code(double x, double y, double z, double t) {
return fma(y, 5.0, (x * fma((y + z), 2.0, t)));
}
function code(x, y, z, t) return fma(y, 5.0, Float64(x * fma(Float64(y + z), 2.0, t))) end
code[x_, y_, z_, t_] := N[(y * 5.0 + N[(x * N[(N[(y + z), $MachinePrecision] * 2.0 + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, 5, x \cdot \mathsf{fma}\left(y + z, 2, t\right)\right)
\end{array}
Initial program 99.9%
+-commutative99.9%
fma-define100.0%
flip-+63.0%
associate-*r/57.2%
fmm-def59.7%
associate-+l+59.7%
+-commutative59.7%
count-259.7%
associate-+l+59.7%
+-commutative59.7%
count-259.7%
fmm-def57.2%
associate-+l+57.2%
+-commutative57.2%
count-257.2%
Applied egg-rr100.0%
(FPCore (x y z t) :precision binary64 (fma x (+ t (* (+ y z) 2.0)) (* y 5.0)))
double code(double x, double y, double z, double t) {
return fma(x, (t + ((y + z) * 2.0)), (y * 5.0));
}
function code(x, y, z, t) return fma(x, Float64(t + Float64(Float64(y + z) * 2.0)), Float64(y * 5.0)) end
code[x_, y_, z_, t_] := N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, t + \left(y + z\right) \cdot 2, y \cdot 5\right)
\end{array}
Initial program 99.9%
fma-define99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.2e-72) (not (<= x 2.8e-49))) (* x (+ t (+ (* (+ y z) 2.0) (* 5.0 (/ y x))))) (+ (* y 5.0) (+ (* x (* z 2.0)) (* x t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.2e-72) || !(x <= 2.8e-49)) {
tmp = x * (t + (((y + z) * 2.0) + (5.0 * (y / x))));
} else {
tmp = (y * 5.0) + ((x * (z * 2.0)) + (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-72)) .or. (.not. (x <= 2.8d-49))) then
tmp = x * (t + (((y + z) * 2.0d0) + (5.0d0 * (y / x))))
else
tmp = (y * 5.0d0) + ((x * (z * 2.0d0)) + (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-72) || !(x <= 2.8e-49)) {
tmp = x * (t + (((y + z) * 2.0) + (5.0 * (y / x))));
} else {
tmp = (y * 5.0) + ((x * (z * 2.0)) + (x * t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.2e-72) or not (x <= 2.8e-49): tmp = x * (t + (((y + z) * 2.0) + (5.0 * (y / x)))) else: tmp = (y * 5.0) + ((x * (z * 2.0)) + (x * t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.2e-72) || !(x <= 2.8e-49)) tmp = Float64(x * Float64(t + Float64(Float64(Float64(y + z) * 2.0) + Float64(5.0 * Float64(y / x))))); else tmp = Float64(Float64(y * 5.0) + Float64(Float64(x * Float64(z * 2.0)) + Float64(x * t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -2.2e-72) || ~((x <= 2.8e-49))) tmp = x * (t + (((y + z) * 2.0) + (5.0 * (y / x)))); else tmp = (y * 5.0) + ((x * (z * 2.0)) + (x * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.2e-72], N[Not[LessEqual[x, 2.8e-49]], $MachinePrecision]], N[(x * N[(t + N[(N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision] + N[(5.0 * N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(N[(x * N[(z * 2.0), $MachinePrecision]), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.2 \cdot 10^{-72} \lor \neg \left(x \leq 2.8 \cdot 10^{-49}\right):\\
\;\;\;\;x \cdot \left(t + \left(\left(y + z\right) \cdot 2 + 5 \cdot \frac{y}{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + \left(x \cdot \left(z \cdot 2\right) + x \cdot t\right)\\
\end{array}
\end{array}
if x < -2.20000000000000002e-72 or 2.79999999999999997e-49 < x Initial program 100.0%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
if -2.20000000000000002e-72 < x < 2.79999999999999997e-49Initial program 99.8%
distribute-lft-in99.8%
*-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
count-299.8%
*-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 99.8%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -88.0) (not (<= x 1.25e-11))) (* x (+ t (* (+ y z) 2.0))) (+ (* y 5.0) (+ (* x (* z 2.0)) (* x t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -88.0) || !(x <= 1.25e-11)) {
tmp = x * (t + ((y + z) * 2.0));
} else {
tmp = (y * 5.0) + ((x * (z * 2.0)) + (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 <= (-88.0d0)) .or. (.not. (x <= 1.25d-11))) then
tmp = x * (t + ((y + z) * 2.0d0))
else
tmp = (y * 5.0d0) + ((x * (z * 2.0d0)) + (x * t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -88.0) || !(x <= 1.25e-11)) {
tmp = x * (t + ((y + z) * 2.0));
} else {
tmp = (y * 5.0) + ((x * (z * 2.0)) + (x * t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -88.0) or not (x <= 1.25e-11): tmp = x * (t + ((y + z) * 2.0)) else: tmp = (y * 5.0) + ((x * (z * 2.0)) + (x * t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -88.0) || !(x <= 1.25e-11)) tmp = Float64(x * Float64(t + Float64(Float64(y + z) * 2.0))); else tmp = Float64(Float64(y * 5.0) + Float64(Float64(x * Float64(z * 2.0)) + Float64(x * t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -88.0) || ~((x <= 1.25e-11))) tmp = x * (t + ((y + z) * 2.0)); else tmp = (y * 5.0) + ((x * (z * 2.0)) + (x * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -88.0], N[Not[LessEqual[x, 1.25e-11]], $MachinePrecision]], N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(N[(x * N[(z * 2.0), $MachinePrecision]), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -88 \lor \neg \left(x \leq 1.25 \cdot 10^{-11}\right):\\
\;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + \left(x \cdot \left(z \cdot 2\right) + x \cdot t\right)\\
\end{array}
\end{array}
if x < -88 or 1.25000000000000005e-11 < x Initial program 100.0%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 98.7%
if -88 < x < 1.25000000000000005e-11Initial program 99.8%
distribute-lft-in99.8%
*-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
count-299.8%
*-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 99.4%
Final simplification99.0%
(FPCore (x y z t)
:precision binary64
(if (<= x -1.2e+51)
(* x (+ t (* y 2.0)))
(if (or (<= x -2.7e-146) (not (<= x 5.2e-78)))
(* x (+ t (* z 2.0)))
(* y 5.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.2e+51) {
tmp = x * (t + (y * 2.0));
} else if ((x <= -2.7e-146) || !(x <= 5.2e-78)) {
tmp = x * (t + (z * 2.0));
} else {
tmp = y * 5.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-1.2d+51)) then
tmp = x * (t + (y * 2.0d0))
else if ((x <= (-2.7d-146)) .or. (.not. (x <= 5.2d-78))) then
tmp = x * (t + (z * 2.0d0))
else
tmp = y * 5.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.2e+51) {
tmp = x * (t + (y * 2.0));
} else if ((x <= -2.7e-146) || !(x <= 5.2e-78)) {
tmp = x * (t + (z * 2.0));
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.2e+51: tmp = x * (t + (y * 2.0)) elif (x <= -2.7e-146) or not (x <= 5.2e-78): tmp = x * (t + (z * 2.0)) else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.2e+51) tmp = Float64(x * Float64(t + Float64(y * 2.0))); elseif ((x <= -2.7e-146) || !(x <= 5.2e-78)) tmp = Float64(x * Float64(t + Float64(z * 2.0))); else tmp = Float64(y * 5.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -1.2e+51) tmp = x * (t + (y * 2.0)); elseif ((x <= -2.7e-146) || ~((x <= 5.2e-78))) tmp = x * (t + (z * 2.0)); else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.2e+51], N[(x * N[(t + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -2.7e-146], N[Not[LessEqual[x, 5.2e-78]], $MachinePrecision]], N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.2 \cdot 10^{+51}:\\
\;\;\;\;x \cdot \left(t + y \cdot 2\right)\\
\mathbf{elif}\;x \leq -2.7 \cdot 10^{-146} \lor \neg \left(x \leq 5.2 \cdot 10^{-78}\right):\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -1.1999999999999999e51Initial program 100.0%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
Taylor expanded in y around inf 79.7%
if -1.1999999999999999e51 < x < -2.69999999999999995e-146 or 5.2000000000000002e-78 < x Initial program 99.9%
+-commutative99.9%
fma-define100.0%
flip-+68.2%
associate-*r/62.2%
fmm-def65.2%
associate-+l+65.2%
+-commutative65.2%
count-265.2%
associate-+l+65.2%
+-commutative65.2%
count-265.2%
fmm-def62.2%
associate-+l+62.2%
+-commutative62.2%
count-262.2%
Applied egg-rr100.0%
Taylor expanded in y around 0 71.6%
if -2.69999999999999995e-146 < x < 5.2000000000000002e-78Initial program 99.9%
+-commutative99.9%
fma-define100.0%
flip-+39.3%
associate-*r/39.2%
fmm-def39.4%
associate-+l+39.4%
+-commutative39.4%
count-239.4%
associate-+l+39.4%
+-commutative39.4%
count-239.4%
fmm-def39.2%
associate-+l+39.2%
+-commutative39.2%
count-239.2%
Applied egg-rr100.0%
Taylor expanded in x around 0 73.1%
*-commutative73.1%
Simplified73.1%
Final simplification74.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4.5e-141) (not (<= x 2.05e-53))) (* x (+ t (* (+ y z) 2.0))) (+ (* y 5.0) (* x t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.5e-141) || !(x <= 2.05e-53)) {
tmp = x * (t + ((y + z) * 2.0));
} else {
tmp = (y * 5.0) + (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 <= (-4.5d-141)) .or. (.not. (x <= 2.05d-53))) then
tmp = x * (t + ((y + z) * 2.0d0))
else
tmp = (y * 5.0d0) + (x * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.5e-141) || !(x <= 2.05e-53)) {
tmp = x * (t + ((y + z) * 2.0));
} else {
tmp = (y * 5.0) + (x * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -4.5e-141) or not (x <= 2.05e-53): tmp = x * (t + ((y + z) * 2.0)) else: tmp = (y * 5.0) + (x * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -4.5e-141) || !(x <= 2.05e-53)) tmp = Float64(x * Float64(t + Float64(Float64(y + z) * 2.0))); else tmp = Float64(Float64(y * 5.0) + Float64(x * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -4.5e-141) || ~((x <= 2.05e-53))) tmp = x * (t + ((y + z) * 2.0)); else tmp = (y * 5.0) + (x * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4.5e-141], N[Not[LessEqual[x, 2.05e-53]], $MachinePrecision]], N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.5 \cdot 10^{-141} \lor \neg \left(x \leq 2.05 \cdot 10^{-53}\right):\\
\;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\
\end{array}
\end{array}
if x < -4.5e-141 or 2.05e-53 < x Initial program 99.9%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 94.1%
if -4.5e-141 < x < 2.05e-53Initial program 99.9%
Taylor expanded in t around inf 92.4%
Final simplification93.5%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.02e+62) (not (<= y 9e+76))) (* y (+ 5.0 (* x 2.0))) (* x (+ t (* z 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.02e+62) || !(y <= 9e+76)) {
tmp = y * (5.0 + (x * 2.0));
} else {
tmp = x * (t + (z * 2.0));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-1.02d+62)) .or. (.not. (y <= 9d+76))) then
tmp = y * (5.0d0 + (x * 2.0d0))
else
tmp = x * (t + (z * 2.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.02e+62) || !(y <= 9e+76)) {
tmp = y * (5.0 + (x * 2.0));
} else {
tmp = x * (t + (z * 2.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.02e+62) or not (y <= 9e+76): tmp = y * (5.0 + (x * 2.0)) else: tmp = x * (t + (z * 2.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.02e+62) || !(y <= 9e+76)) tmp = Float64(y * Float64(5.0 + Float64(x * 2.0))); else tmp = Float64(x * Float64(t + Float64(z * 2.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.02e+62) || ~((y <= 9e+76))) tmp = y * (5.0 + (x * 2.0)); else tmp = x * (t + (z * 2.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.02e+62], N[Not[LessEqual[y, 9e+76]], $MachinePrecision]], N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.02 \cdot 10^{+62} \lor \neg \left(y \leq 9 \cdot 10^{+76}\right):\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\
\end{array}
\end{array}
if y < -1.02000000000000002e62 or 8.9999999999999995e76 < y Initial program 99.9%
fma-define99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in y around inf 84.2%
if -1.02000000000000002e62 < y < 8.9999999999999995e76Initial program 99.9%
+-commutative99.9%
fma-define100.0%
flip-+73.5%
associate-*r/67.0%
fmm-def67.7%
associate-+l+67.7%
+-commutative67.7%
count-267.7%
associate-+l+67.7%
+-commutative67.7%
count-267.7%
fmm-def67.0%
associate-+l+67.0%
+-commutative67.0%
count-267.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 76.4%
Final simplification79.5%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3.4e-19) (not (<= x 7.5e-74))) (* x (+ t (* y 2.0))) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.4e-19) || !(x <= 7.5e-74)) {
tmp = x * (t + (y * 2.0));
} else {
tmp = y * 5.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-3.4d-19)) .or. (.not. (x <= 7.5d-74))) then
tmp = x * (t + (y * 2.0d0))
else
tmp = y * 5.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.4e-19) || !(x <= 7.5e-74)) {
tmp = x * (t + (y * 2.0));
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3.4e-19) or not (x <= 7.5e-74): tmp = x * (t + (y * 2.0)) else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -3.4e-19) || !(x <= 7.5e-74)) tmp = Float64(x * Float64(t + Float64(y * 2.0))); else tmp = Float64(y * 5.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -3.4e-19) || ~((x <= 7.5e-74))) tmp = x * (t + (y * 2.0)); else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -3.4e-19], N[Not[LessEqual[x, 7.5e-74]], $MachinePrecision]], N[(x * N[(t + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.4 \cdot 10^{-19} \lor \neg \left(x \leq 7.5 \cdot 10^{-74}\right):\\
\;\;\;\;x \cdot \left(t + y \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -3.4000000000000002e-19 or 7.5e-74 < x Initial program 100.0%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 96.7%
Taylor expanded in y around inf 68.4%
if -3.4000000000000002e-19 < x < 7.5e-74Initial program 99.8%
+-commutative99.8%
fma-define100.0%
flip-+40.7%
associate-*r/40.7%
fmm-def40.9%
associate-+l+40.9%
+-commutative40.9%
count-240.9%
associate-+l+40.9%
+-commutative40.9%
count-240.9%
fmm-def40.7%
associate-+l+40.7%
+-commutative40.7%
count-240.7%
Applied egg-rr100.0%
Taylor expanded in x around 0 68.8%
*-commutative68.8%
Simplified68.8%
Final simplification68.6%
(FPCore (x y z t) :precision binary64 (+ (* y 5.0) (* x (+ t (+ y (+ z (+ y z)))))))
double code(double x, double y, double z, double t) {
return (y * 5.0) + (x * (t + (y + (z + (y + z)))));
}
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) + (x * (t + (y + (z + (y + z)))))
end function
public static double code(double x, double y, double z, double t) {
return (y * 5.0) + (x * (t + (y + (z + (y + z)))));
}
def code(x, y, z, t): return (y * 5.0) + (x * (t + (y + (z + (y + z)))))
function code(x, y, z, t) return Float64(Float64(y * 5.0) + Float64(x * Float64(t + Float64(y + Float64(z + Float64(y + z)))))) end
function tmp = code(x, y, z, t) tmp = (y * 5.0) + (x * (t + (y + (z + (y + z))))); end
code[x_, y_, z_, t_] := N[(N[(y * 5.0), $MachinePrecision] + N[(x * N[(t + N[(y + N[(z + N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot 5 + x \cdot \left(t + \left(y + \left(z + \left(y + z\right)\right)\right)\right)
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4.2e-37) (not (<= x 1.9e-67))) (* x t) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.2e-37) || !(x <= 1.9e-67)) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-4.2d-37)) .or. (.not. (x <= 1.9d-67))) then
tmp = x * t
else
tmp = y * 5.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.2e-37) || !(x <= 1.9e-67)) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -4.2e-37) or not (x <= 1.9e-67): tmp = x * t else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -4.2e-37) || !(x <= 1.9e-67)) tmp = Float64(x * t); else tmp = Float64(y * 5.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -4.2e-37) || ~((x <= 1.9e-67))) tmp = x * t; else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4.2e-37], N[Not[LessEqual[x, 1.9e-67]], $MachinePrecision]], N[(x * t), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.2 \cdot 10^{-37} \lor \neg \left(x \leq 1.9 \cdot 10^{-67}\right):\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -4.2000000000000002e-37 or 1.89999999999999994e-67 < x Initial program 100.0%
+-commutative100.0%
fma-define100.0%
flip-+77.2%
associate-*r/67.8%
fmm-def71.7%
associate-+l+71.8%
+-commutative71.8%
count-271.8%
associate-+l+71.7%
+-commutative71.7%
count-271.7%
fmm-def67.8%
associate-+l+67.8%
+-commutative67.8%
count-267.8%
Applied egg-rr100.0%
Taylor expanded in t around inf 40.5%
*-commutative40.5%
Simplified40.5%
if -4.2000000000000002e-37 < x < 1.89999999999999994e-67Initial program 99.8%
+-commutative99.8%
fma-define100.0%
flip-+40.7%
associate-*r/40.7%
fmm-def40.9%
associate-+l+40.9%
+-commutative40.9%
count-240.9%
associate-+l+40.9%
+-commutative40.9%
count-240.9%
fmm-def40.7%
associate-+l+40.7%
+-commutative40.7%
count-240.7%
Applied egg-rr100.0%
Taylor expanded in x around 0 68.8%
*-commutative68.8%
Simplified68.8%
Final simplification51.5%
(FPCore (x y z t) :precision binary64 (* x t))
double code(double x, double y, double z, double t) {
return x * t;
}
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 * t
end function
public static double code(double x, double y, double z, double t) {
return x * t;
}
def code(x, y, z, t): return x * t
function code(x, y, z, t) return Float64(x * t) end
function tmp = code(x, y, z, t) tmp = x * t; end
code[x_, y_, z_, t_] := N[(x * t), $MachinePrecision]
\begin{array}{l}
\\
x \cdot t
\end{array}
Initial program 99.9%
+-commutative99.9%
fma-define100.0%
flip-+63.0%
associate-*r/57.2%
fmm-def59.7%
associate-+l+59.7%
+-commutative59.7%
count-259.7%
associate-+l+59.7%
+-commutative59.7%
count-259.7%
fmm-def57.2%
associate-+l+57.2%
+-commutative57.2%
count-257.2%
Applied egg-rr100.0%
Taylor expanded in t around inf 33.2%
*-commutative33.2%
Simplified33.2%
herbie shell --seed 2024172
(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)))