
(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 x (+ (* 2.0 (+ y z)) t) (* y 5.0)))
double code(double x, double y, double z, double t) {
return fma(x, ((2.0 * (y + z)) + t), (y * 5.0));
}
function code(x, y, z, t) return fma(x, Float64(Float64(2.0 * Float64(y + z)) + t), Float64(y * 5.0)) end
code[x_, y_, z_, t_] := N[(x * N[(N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, 2 \cdot \left(y + z\right) + t, 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
(let* ((t_1 (* 2.0 (* x z))))
(if (<= x -8.6e+69)
(* x t)
(if (<= x -6.8e-19)
t_1
(if (<= x -7e-26)
(* x t)
(if (<= x 1e-31) (* y 5.0) (if (<= x 2.1e+96) (* x t) t_1)))))))
double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (x * z);
double tmp;
if (x <= -8.6e+69) {
tmp = x * t;
} else if (x <= -6.8e-19) {
tmp = t_1;
} else if (x <= -7e-26) {
tmp = x * t;
} else if (x <= 1e-31) {
tmp = y * 5.0;
} else if (x <= 2.1e+96) {
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 = 2.0d0 * (x * z)
if (x <= (-8.6d+69)) then
tmp = x * t
else if (x <= (-6.8d-19)) then
tmp = t_1
else if (x <= (-7d-26)) then
tmp = x * t
else if (x <= 1d-31) then
tmp = y * 5.0d0
else if (x <= 2.1d+96) 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 = 2.0 * (x * z);
double tmp;
if (x <= -8.6e+69) {
tmp = x * t;
} else if (x <= -6.8e-19) {
tmp = t_1;
} else if (x <= -7e-26) {
tmp = x * t;
} else if (x <= 1e-31) {
tmp = y * 5.0;
} else if (x <= 2.1e+96) {
tmp = x * t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = 2.0 * (x * z) tmp = 0 if x <= -8.6e+69: tmp = x * t elif x <= -6.8e-19: tmp = t_1 elif x <= -7e-26: tmp = x * t elif x <= 1e-31: tmp = y * 5.0 elif x <= 2.1e+96: tmp = x * t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(2.0 * Float64(x * z)) tmp = 0.0 if (x <= -8.6e+69) tmp = Float64(x * t); elseif (x <= -6.8e-19) tmp = t_1; elseif (x <= -7e-26) tmp = Float64(x * t); elseif (x <= 1e-31) tmp = Float64(y * 5.0); elseif (x <= 2.1e+96) tmp = Float64(x * t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 2.0 * (x * z); tmp = 0.0; if (x <= -8.6e+69) tmp = x * t; elseif (x <= -6.8e-19) tmp = t_1; elseif (x <= -7e-26) tmp = x * t; elseif (x <= 1e-31) tmp = y * 5.0; elseif (x <= 2.1e+96) tmp = x * t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -8.6e+69], N[(x * t), $MachinePrecision], If[LessEqual[x, -6.8e-19], t$95$1, If[LessEqual[x, -7e-26], N[(x * t), $MachinePrecision], If[LessEqual[x, 1e-31], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 2.1e+96], N[(x * t), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;x \leq -8.6 \cdot 10^{+69}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq -6.8 \cdot 10^{-19}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -7 \cdot 10^{-26}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 10^{-31}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 2.1 \cdot 10^{+96}:\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -8.59999999999999986e69 or -6.8000000000000004e-19 < x < -6.9999999999999997e-26 or 1e-31 < x < 2.1000000000000001e96Initial program 100.0%
Taylor expanded in t around inf 54.7%
Simplified54.7%
if -8.59999999999999986e69 < x < -6.8000000000000004e-19 or 2.1000000000000001e96 < x Initial program 100.0%
Taylor expanded in z around inf 53.5%
if -6.9999999999999997e-26 < x < 1e-31Initial program 99.8%
Taylor expanded in x around 0 67.1%
Final simplification59.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ (* 2.0 (+ y z)) t))))
(if (<= x -1.05e-16)
t_1
(if (<= x -4.3e-113)
(* t (+ x (* y (/ 5.0 t))))
(if (<= x -1.56e-139)
(* x (+ t (* 2.0 z)))
(if (<= x 2.25e-95) (* y 5.0) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x * ((2.0 * (y + z)) + t);
double tmp;
if (x <= -1.05e-16) {
tmp = t_1;
} else if (x <= -4.3e-113) {
tmp = t * (x + (y * (5.0 / t)));
} else if (x <= -1.56e-139) {
tmp = x * (t + (2.0 * z));
} else if (x <= 2.25e-95) {
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 * ((2.0d0 * (y + z)) + t)
if (x <= (-1.05d-16)) then
tmp = t_1
else if (x <= (-4.3d-113)) then
tmp = t * (x + (y * (5.0d0 / t)))
else if (x <= (-1.56d-139)) then
tmp = x * (t + (2.0d0 * z))
else if (x <= 2.25d-95) 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 * ((2.0 * (y + z)) + t);
double tmp;
if (x <= -1.05e-16) {
tmp = t_1;
} else if (x <= -4.3e-113) {
tmp = t * (x + (y * (5.0 / t)));
} else if (x <= -1.56e-139) {
tmp = x * (t + (2.0 * z));
} else if (x <= 2.25e-95) {
tmp = y * 5.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * ((2.0 * (y + z)) + t) tmp = 0 if x <= -1.05e-16: tmp = t_1 elif x <= -4.3e-113: tmp = t * (x + (y * (5.0 / t))) elif x <= -1.56e-139: tmp = x * (t + (2.0 * z)) elif x <= 2.25e-95: tmp = y * 5.0 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(Float64(2.0 * Float64(y + z)) + t)) tmp = 0.0 if (x <= -1.05e-16) tmp = t_1; elseif (x <= -4.3e-113) tmp = Float64(t * Float64(x + Float64(y * Float64(5.0 / t)))); elseif (x <= -1.56e-139) tmp = Float64(x * Float64(t + Float64(2.0 * z))); elseif (x <= 2.25e-95) tmp = Float64(y * 5.0); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * ((2.0 * (y + z)) + t); tmp = 0.0; if (x <= -1.05e-16) tmp = t_1; elseif (x <= -4.3e-113) tmp = t * (x + (y * (5.0 / t))); elseif (x <= -1.56e-139) tmp = x * (t + (2.0 * z)); elseif (x <= 2.25e-95) 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[(N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.05e-16], t$95$1, If[LessEqual[x, -4.3e-113], N[(t * N[(x + N[(y * N[(5.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.56e-139], N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.25e-95], N[(y * 5.0), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(2 \cdot \left(y + z\right) + t\right)\\
\mathbf{if}\;x \leq -1.05 \cdot 10^{-16}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -4.3 \cdot 10^{-113}:\\
\;\;\;\;t \cdot \left(x + y \cdot \frac{5}{t}\right)\\
\mathbf{elif}\;x \leq -1.56 \cdot 10^{-139}:\\
\;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\
\mathbf{elif}\;x \leq 2.25 \cdot 10^{-95}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.0500000000000001e-16 or 2.25e-95 < 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.0%
if -1.0500000000000001e-16 < x < -4.3e-113Initial program 99.8%
fma-define99.8%
associate-+l+99.8%
+-commutative99.8%
count-299.8%
Simplified99.8%
Taylor expanded in t around inf 93.1%
Taylor expanded in x around 0 80.7%
associate-*r/80.6%
*-commutative80.6%
associate-/l*80.6%
Simplified80.6%
if -4.3e-113 < x < -1.56000000000000008e-139Initial program 100.0%
Taylor expanded in y around 0 88.2%
if -1.56000000000000008e-139 < x < 2.25e-95Initial program 99.8%
Taylor expanded in x around 0 74.1%
Final simplification87.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 2.0 (+ y z))))
(if (<= y -5.3e+169)
(+ (* y 5.0) (* x t_1))
(if (<= y 9e+70)
(* x (+ t (+ t_1 (* 5.0 (/ y x)))))
(+ (* y 5.0) (* x (+ t (+ y y))))))))
double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (y + z);
double tmp;
if (y <= -5.3e+169) {
tmp = (y * 5.0) + (x * t_1);
} else if (y <= 9e+70) {
tmp = x * (t + (t_1 + (5.0 * (y / x))));
} else {
tmp = (y * 5.0) + (x * (t + (y + y)));
}
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 = 2.0d0 * (y + z)
if (y <= (-5.3d+169)) then
tmp = (y * 5.0d0) + (x * t_1)
else if (y <= 9d+70) then
tmp = x * (t + (t_1 + (5.0d0 * (y / x))))
else
tmp = (y * 5.0d0) + (x * (t + (y + y)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (y + z);
double tmp;
if (y <= -5.3e+169) {
tmp = (y * 5.0) + (x * t_1);
} else if (y <= 9e+70) {
tmp = x * (t + (t_1 + (5.0 * (y / x))));
} else {
tmp = (y * 5.0) + (x * (t + (y + y)));
}
return tmp;
}
def code(x, y, z, t): t_1 = 2.0 * (y + z) tmp = 0 if y <= -5.3e+169: tmp = (y * 5.0) + (x * t_1) elif y <= 9e+70: tmp = x * (t + (t_1 + (5.0 * (y / x)))) else: tmp = (y * 5.0) + (x * (t + (y + y))) return tmp
function code(x, y, z, t) t_1 = Float64(2.0 * Float64(y + z)) tmp = 0.0 if (y <= -5.3e+169) tmp = Float64(Float64(y * 5.0) + Float64(x * t_1)); elseif (y <= 9e+70) tmp = Float64(x * Float64(t + Float64(t_1 + Float64(5.0 * Float64(y / x))))); else tmp = Float64(Float64(y * 5.0) + Float64(x * Float64(t + Float64(y + y)))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 2.0 * (y + z); tmp = 0.0; if (y <= -5.3e+169) tmp = (y * 5.0) + (x * t_1); elseif (y <= 9e+70) tmp = x * (t + (t_1 + (5.0 * (y / x)))); else tmp = (y * 5.0) + (x * (t + (y + y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.3e+169], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9e+70], N[(x * N[(t + N[(t$95$1 + N[(5.0 * N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(x * N[(t + N[(y + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(y + z\right)\\
\mathbf{if}\;y \leq -5.3 \cdot 10^{+169}:\\
\;\;\;\;y \cdot 5 + x \cdot t\_1\\
\mathbf{elif}\;y \leq 9 \cdot 10^{+70}:\\
\;\;\;\;x \cdot \left(t + \left(t\_1 + 5 \cdot \frac{y}{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + x \cdot \left(t + \left(y + y\right)\right)\\
\end{array}
\end{array}
if y < -5.2999999999999999e169Initial program 99.9%
Taylor expanded in t around 0 97.2%
Simplified97.2%
if -5.2999999999999999e169 < y < 8.9999999999999999e70Initial program 99.9%
fma-define99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in x around inf 98.3%
if 8.9999999999999999e70 < y Initial program 99.9%
Taylor expanded in y around inf 93.7%
Final simplification97.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 2.0 (+ y z))))
(if (<= t -2.8e+107)
(* t (+ x (* y (/ 5.0 t))))
(if (<= t 3.4e-67) (+ (* y 5.0) (* x t_1)) (* x (+ t_1 t))))))
double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (y + z);
double tmp;
if (t <= -2.8e+107) {
tmp = t * (x + (y * (5.0 / t)));
} else if (t <= 3.4e-67) {
tmp = (y * 5.0) + (x * t_1);
} else {
tmp = x * (t_1 + 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) :: t_1
real(8) :: tmp
t_1 = 2.0d0 * (y + z)
if (t <= (-2.8d+107)) then
tmp = t * (x + (y * (5.0d0 / t)))
else if (t <= 3.4d-67) then
tmp = (y * 5.0d0) + (x * t_1)
else
tmp = x * (t_1 + t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (y + z);
double tmp;
if (t <= -2.8e+107) {
tmp = t * (x + (y * (5.0 / t)));
} else if (t <= 3.4e-67) {
tmp = (y * 5.0) + (x * t_1);
} else {
tmp = x * (t_1 + t);
}
return tmp;
}
def code(x, y, z, t): t_1 = 2.0 * (y + z) tmp = 0 if t <= -2.8e+107: tmp = t * (x + (y * (5.0 / t))) elif t <= 3.4e-67: tmp = (y * 5.0) + (x * t_1) else: tmp = x * (t_1 + t) return tmp
function code(x, y, z, t) t_1 = Float64(2.0 * Float64(y + z)) tmp = 0.0 if (t <= -2.8e+107) tmp = Float64(t * Float64(x + Float64(y * Float64(5.0 / t)))); elseif (t <= 3.4e-67) tmp = Float64(Float64(y * 5.0) + Float64(x * t_1)); else tmp = Float64(x * Float64(t_1 + t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 2.0 * (y + z); tmp = 0.0; if (t <= -2.8e+107) tmp = t * (x + (y * (5.0 / t))); elseif (t <= 3.4e-67) tmp = (y * 5.0) + (x * t_1); else tmp = x * (t_1 + t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -2.8e+107], N[(t * N[(x + N[(y * N[(5.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.4e-67], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t$95$1), $MachinePrecision]), $MachinePrecision], N[(x * N[(t$95$1 + t), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(y + z\right)\\
\mathbf{if}\;t \leq -2.8 \cdot 10^{+107}:\\
\;\;\;\;t \cdot \left(x + y \cdot \frac{5}{t}\right)\\
\mathbf{elif}\;t \leq 3.4 \cdot 10^{-67}:\\
\;\;\;\;y \cdot 5 + x \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t\_1 + t\right)\\
\end{array}
\end{array}
if t < -2.79999999999999985e107Initial program 100.0%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in t around inf 97.4%
Taylor expanded in x around 0 98.1%
associate-*r/98.2%
*-commutative98.2%
associate-/l*98.1%
Simplified98.1%
if -2.79999999999999985e107 < t < 3.4000000000000001e-67Initial program 99.9%
Taylor expanded in t around 0 94.5%
Simplified94.5%
if 3.4000000000000001e-67 < t Initial program 99.9%
fma-define99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in x around inf 84.9%
Final simplification92.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 2.0 (+ y z))))
(if (<= t -7.8e+106)
(+ (* y 5.0) (* x (+ t (+ y y))))
(if (<= t 9.5e-66) (+ (* y 5.0) (* x t_1)) (* x (+ t_1 t))))))
double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (y + z);
double tmp;
if (t <= -7.8e+106) {
tmp = (y * 5.0) + (x * (t + (y + y)));
} else if (t <= 9.5e-66) {
tmp = (y * 5.0) + (x * t_1);
} else {
tmp = x * (t_1 + 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) :: t_1
real(8) :: tmp
t_1 = 2.0d0 * (y + z)
if (t <= (-7.8d+106)) then
tmp = (y * 5.0d0) + (x * (t + (y + y)))
else if (t <= 9.5d-66) then
tmp = (y * 5.0d0) + (x * t_1)
else
tmp = x * (t_1 + t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (y + z);
double tmp;
if (t <= -7.8e+106) {
tmp = (y * 5.0) + (x * (t + (y + y)));
} else if (t <= 9.5e-66) {
tmp = (y * 5.0) + (x * t_1);
} else {
tmp = x * (t_1 + t);
}
return tmp;
}
def code(x, y, z, t): t_1 = 2.0 * (y + z) tmp = 0 if t <= -7.8e+106: tmp = (y * 5.0) + (x * (t + (y + y))) elif t <= 9.5e-66: tmp = (y * 5.0) + (x * t_1) else: tmp = x * (t_1 + t) return tmp
function code(x, y, z, t) t_1 = Float64(2.0 * Float64(y + z)) tmp = 0.0 if (t <= -7.8e+106) tmp = Float64(Float64(y * 5.0) + Float64(x * Float64(t + Float64(y + y)))); elseif (t <= 9.5e-66) tmp = Float64(Float64(y * 5.0) + Float64(x * t_1)); else tmp = Float64(x * Float64(t_1 + t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 2.0 * (y + z); tmp = 0.0; if (t <= -7.8e+106) tmp = (y * 5.0) + (x * (t + (y + y))); elseif (t <= 9.5e-66) tmp = (y * 5.0) + (x * t_1); else tmp = x * (t_1 + t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -7.8e+106], N[(N[(y * 5.0), $MachinePrecision] + N[(x * N[(t + N[(y + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 9.5e-66], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t$95$1), $MachinePrecision]), $MachinePrecision], N[(x * N[(t$95$1 + t), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(y + z\right)\\
\mathbf{if}\;t \leq -7.8 \cdot 10^{+106}:\\
\;\;\;\;y \cdot 5 + x \cdot \left(t + \left(y + y\right)\right)\\
\mathbf{elif}\;t \leq 9.5 \cdot 10^{-66}:\\
\;\;\;\;y \cdot 5 + x \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t\_1 + t\right)\\
\end{array}
\end{array}
if t < -7.79999999999999937e106Initial program 100.0%
Taylor expanded in y around inf 98.2%
if -7.79999999999999937e106 < t < 9.5000000000000004e-66Initial program 99.9%
Taylor expanded in t around 0 94.5%
Simplified94.5%
if 9.5000000000000004e-66 < t Initial program 99.9%
fma-define99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in x around inf 84.9%
Final simplification92.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.62e-139) (not (<= x 1.1e-66))) (* x (+ t (* 2.0 z))) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.62e-139) || !(x <= 1.1e-66)) {
tmp = x * (t + (2.0 * z));
} 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.62d-139)) .or. (.not. (x <= 1.1d-66))) then
tmp = x * (t + (2.0d0 * z))
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.62e-139) || !(x <= 1.1e-66)) {
tmp = x * (t + (2.0 * z));
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.62e-139) or not (x <= 1.1e-66): tmp = x * (t + (2.0 * z)) else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.62e-139) || !(x <= 1.1e-66)) tmp = Float64(x * Float64(t + Float64(2.0 * z))); else tmp = Float64(y * 5.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.62e-139) || ~((x <= 1.1e-66))) tmp = x * (t + (2.0 * z)); else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.62e-139], N[Not[LessEqual[x, 1.1e-66]], $MachinePrecision]], N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.62 \cdot 10^{-139} \lor \neg \left(x \leq 1.1 \cdot 10^{-66}\right):\\
\;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -1.62000000000000001e-139 or 1.1000000000000001e-66 < x Initial program 100.0%
Taylor expanded in y around 0 73.2%
if -1.62000000000000001e-139 < x < 1.1000000000000001e-66Initial program 99.8%
Taylor expanded in x around 0 73.6%
Final simplification73.3%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2e+103) (not (<= y 1e+43))) (* y (+ 5.0 (* x 2.0))) (* x (+ t (* 2.0 z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2e+103) || !(y <= 1e+43)) {
tmp = y * (5.0 + (x * 2.0));
} else {
tmp = x * (t + (2.0 * z));
}
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 <= (-2d+103)) .or. (.not. (y <= 1d+43))) then
tmp = y * (5.0d0 + (x * 2.0d0))
else
tmp = x * (t + (2.0d0 * z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2e+103) || !(y <= 1e+43)) {
tmp = y * (5.0 + (x * 2.0));
} else {
tmp = x * (t + (2.0 * z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2e+103) or not (y <= 1e+43): tmp = y * (5.0 + (x * 2.0)) else: tmp = x * (t + (2.0 * z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2e+103) || !(y <= 1e+43)) tmp = Float64(y * Float64(5.0 + Float64(x * 2.0))); else tmp = Float64(x * Float64(t + Float64(2.0 * z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -2e+103) || ~((y <= 1e+43))) tmp = y * (5.0 + (x * 2.0)); else tmp = x * (t + (2.0 * z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2e+103], N[Not[LessEqual[y, 1e+43]], $MachinePrecision]], N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2 \cdot 10^{+103} \lor \neg \left(y \leq 10^{+43}\right):\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\
\end{array}
\end{array}
if y < -2e103 or 1.00000000000000001e43 < y Initial program 99.8%
Taylor expanded in y around inf 84.8%
Simplified84.8%
if -2e103 < y < 1.00000000000000001e43Initial program 100.0%
Taylor expanded in y around 0 78.3%
Final simplification80.8%
(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 -1.7e-40) (not (<= x 8.5e-32))) (* x t) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.7e-40) || !(x <= 8.5e-32)) {
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 <= (-1.7d-40)) .or. (.not. (x <= 8.5d-32))) 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 <= -1.7e-40) || !(x <= 8.5e-32)) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.7e-40) or not (x <= 8.5e-32): tmp = x * t else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.7e-40) || !(x <= 8.5e-32)) 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 <= -1.7e-40) || ~((x <= 8.5e-32))) tmp = x * t; else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.7e-40], N[Not[LessEqual[x, 8.5e-32]], $MachinePrecision]], N[(x * t), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.7 \cdot 10^{-40} \lor \neg \left(x \leq 8.5 \cdot 10^{-32}\right):\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -1.69999999999999992e-40 or 8.5000000000000003e-32 < x Initial program 100.0%
Taylor expanded in t around inf 45.2%
Simplified45.2%
if -1.69999999999999992e-40 < x < 8.5000000000000003e-32Initial program 99.8%
Taylor expanded in x around 0 67.1%
Final simplification54.6%
(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 30.8%
Final simplification30.8%
herbie shell --seed 2024078
(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)))