
(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 14 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+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.9e-13) (not (<= x 5e-18))) (* x (+ t (+ (* 2.0 (+ y z)) (* 5.0 (/ y x))))) (+ (* y 5.0) (* x (+ t (* 2.0 z))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.9e-13) || !(x <= 5e-18)) {
tmp = x * (t + ((2.0 * (y + z)) + (5.0 * (y / x))));
} else {
tmp = (y * 5.0) + (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 ((x <= (-2.9d-13)) .or. (.not. (x <= 5d-18))) then
tmp = x * (t + ((2.0d0 * (y + z)) + (5.0d0 * (y / x))))
else
tmp = (y * 5.0d0) + (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 ((x <= -2.9e-13) || !(x <= 5e-18)) {
tmp = x * (t + ((2.0 * (y + z)) + (5.0 * (y / x))));
} else {
tmp = (y * 5.0) + (x * (t + (2.0 * z)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.9e-13) or not (x <= 5e-18): tmp = x * (t + ((2.0 * (y + z)) + (5.0 * (y / x)))) else: tmp = (y * 5.0) + (x * (t + (2.0 * z))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.9e-13) || !(x <= 5e-18)) tmp = Float64(x * Float64(t + Float64(Float64(2.0 * Float64(y + z)) + Float64(5.0 * Float64(y / x))))); else tmp = Float64(Float64(y * 5.0) + Float64(x * Float64(t + Float64(2.0 * z)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -2.9e-13) || ~((x <= 5e-18))) tmp = x * (t + ((2.0 * (y + z)) + (5.0 * (y / x)))); else tmp = (y * 5.0) + (x * (t + (2.0 * z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.9e-13], N[Not[LessEqual[x, 5e-18]], $MachinePrecision]], N[(x * N[(t + N[(N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision] + N[(5.0 * N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.9 \cdot 10^{-13} \lor \neg \left(x \leq 5 \cdot 10^{-18}\right):\\
\;\;\;\;x \cdot \left(t + \left(2 \cdot \left(y + z\right) + 5 \cdot \frac{y}{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + x \cdot \left(t + 2 \cdot z\right)\\
\end{array}
\end{array}
if x < -2.8999999999999998e-13 or 5.00000000000000036e-18 < 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.8999999999999998e-13 < x < 5.00000000000000036e-18Initial program 99.9%
Taylor expanded in y around 0 99.9%
Final simplification99.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ (* 2.0 (+ y z)) t))))
(if (<= x -3.6e-40)
t_1
(if (<= x 2.15e-155)
(+ (* 2.0 (* x z)) (* y 5.0))
(if (<= x 9.8e-36) (+ (* y 5.0) (* x t)) 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 <= -3.6e-40) {
tmp = t_1;
} else if (x <= 2.15e-155) {
tmp = (2.0 * (x * z)) + (y * 5.0);
} else if (x <= 9.8e-36) {
tmp = (y * 5.0) + (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 * ((2.0d0 * (y + z)) + t)
if (x <= (-3.6d-40)) then
tmp = t_1
else if (x <= 2.15d-155) then
tmp = (2.0d0 * (x * z)) + (y * 5.0d0)
else if (x <= 9.8d-36) then
tmp = (y * 5.0d0) + (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 * ((2.0 * (y + z)) + t);
double tmp;
if (x <= -3.6e-40) {
tmp = t_1;
} else if (x <= 2.15e-155) {
tmp = (2.0 * (x * z)) + (y * 5.0);
} else if (x <= 9.8e-36) {
tmp = (y * 5.0) + (x * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * ((2.0 * (y + z)) + t) tmp = 0 if x <= -3.6e-40: tmp = t_1 elif x <= 2.15e-155: tmp = (2.0 * (x * z)) + (y * 5.0) elif x <= 9.8e-36: tmp = (y * 5.0) + (x * t) 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 <= -3.6e-40) tmp = t_1; elseif (x <= 2.15e-155) tmp = Float64(Float64(2.0 * Float64(x * z)) + Float64(y * 5.0)); elseif (x <= 9.8e-36) tmp = Float64(Float64(y * 5.0) + Float64(x * t)); 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 <= -3.6e-40) tmp = t_1; elseif (x <= 2.15e-155) tmp = (2.0 * (x * z)) + (y * 5.0); elseif (x <= 9.8e-36) tmp = (y * 5.0) + (x * t); 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, -3.6e-40], t$95$1, If[LessEqual[x, 2.15e-155], N[(N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 9.8e-36], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $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 -3.6 \cdot 10^{-40}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.15 \cdot 10^{-155}:\\
\;\;\;\;2 \cdot \left(x \cdot z\right) + y \cdot 5\\
\mathbf{elif}\;x \leq 9.8 \cdot 10^{-36}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -3.6e-40 or 9.7999999999999994e-36 < 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 95.5%
if -3.6e-40 < x < 2.15000000000000004e-155Initial program 99.9%
Taylor expanded in y around 0 99.9%
Taylor expanded in t around 0 84.9%
if 2.15000000000000004e-155 < x < 9.7999999999999994e-36Initial program 99.8%
Taylor expanded in y around 0 99.8%
Taylor expanded in z around 0 91.4%
Final simplification91.3%
(FPCore (x y z t)
:precision binary64
(if (<= x -8.2e+111)
(* x (+ t (* 2.0 y)))
(if (or (<= x -3.3e-102) (not (<= x 6.8e-77)))
(* x (+ t (* 2.0 z)))
(* y 5.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -8.2e+111) {
tmp = x * (t + (2.0 * y));
} else if ((x <= -3.3e-102) || !(x <= 6.8e-77)) {
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 <= (-8.2d+111)) then
tmp = x * (t + (2.0d0 * y))
else if ((x <= (-3.3d-102)) .or. (.not. (x <= 6.8d-77))) 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 <= -8.2e+111) {
tmp = x * (t + (2.0 * y));
} else if ((x <= -3.3e-102) || !(x <= 6.8e-77)) {
tmp = x * (t + (2.0 * z));
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -8.2e+111: tmp = x * (t + (2.0 * y)) elif (x <= -3.3e-102) or not (x <= 6.8e-77): tmp = x * (t + (2.0 * z)) else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -8.2e+111) tmp = Float64(x * Float64(t + Float64(2.0 * y))); elseif ((x <= -3.3e-102) || !(x <= 6.8e-77)) 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 <= -8.2e+111) tmp = x * (t + (2.0 * y)); elseif ((x <= -3.3e-102) || ~((x <= 6.8e-77))) tmp = x * (t + (2.0 * z)); else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -8.2e+111], N[(x * N[(t + N[(2.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -3.3e-102], N[Not[LessEqual[x, 6.8e-77]], $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 -8.2 \cdot 10^{+111}:\\
\;\;\;\;x \cdot \left(t + 2 \cdot y\right)\\
\mathbf{elif}\;x \leq -3.3 \cdot 10^{-102} \lor \neg \left(x \leq 6.8 \cdot 10^{-77}\right):\\
\;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -8.19999999999999973e111Initial program 99.9%
fma-define99.9%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
Taylor expanded in z around 0 82.1%
if -8.19999999999999973e111 < x < -3.3e-102 or 6.79999999999999966e-77 < x Initial program 100.0%
Taylor expanded in y around 0 69.9%
if -3.3e-102 < x < 6.79999999999999966e-77Initial program 99.9%
Taylor expanded in x around 0 65.1%
Final simplification69.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (+ 5.0 (* x 2.0)))))
(if (<= y -500000.0)
t_1
(if (<= y 5.6e-28)
(* x (+ t (* 2.0 z)))
(if (<= y 1.6e+64) (+ (* y 5.0) (* x t)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = y * (5.0 + (x * 2.0));
double tmp;
if (y <= -500000.0) {
tmp = t_1;
} else if (y <= 5.6e-28) {
tmp = x * (t + (2.0 * z));
} else if (y <= 1.6e+64) {
tmp = (y * 5.0) + (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 = y * (5.0d0 + (x * 2.0d0))
if (y <= (-500000.0d0)) then
tmp = t_1
else if (y <= 5.6d-28) then
tmp = x * (t + (2.0d0 * z))
else if (y <= 1.6d+64) then
tmp = (y * 5.0d0) + (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 = y * (5.0 + (x * 2.0));
double tmp;
if (y <= -500000.0) {
tmp = t_1;
} else if (y <= 5.6e-28) {
tmp = x * (t + (2.0 * z));
} else if (y <= 1.6e+64) {
tmp = (y * 5.0) + (x * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (5.0 + (x * 2.0)) tmp = 0 if y <= -500000.0: tmp = t_1 elif y <= 5.6e-28: tmp = x * (t + (2.0 * z)) elif y <= 1.6e+64: tmp = (y * 5.0) + (x * t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(5.0 + Float64(x * 2.0))) tmp = 0.0 if (y <= -500000.0) tmp = t_1; elseif (y <= 5.6e-28) tmp = Float64(x * Float64(t + Float64(2.0 * z))); elseif (y <= 1.6e+64) tmp = Float64(Float64(y * 5.0) + Float64(x * t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (5.0 + (x * 2.0)); tmp = 0.0; if (y <= -500000.0) tmp = t_1; elseif (y <= 5.6e-28) tmp = x * (t + (2.0 * z)); elseif (y <= 1.6e+64) tmp = (y * 5.0) + (x * t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -500000.0], t$95$1, If[LessEqual[y, 5.6e-28], N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.6e+64], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{if}\;y \leq -500000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 5.6 \cdot 10^{-28}:\\
\;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{+64}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -5e5 or 1.60000000000000009e64 < y Initial program 99.9%
Taylor expanded in y around inf 79.1%
Simplified79.1%
if -5e5 < y < 5.5999999999999996e-28Initial program 100.0%
Taylor expanded in y around 0 85.1%
if 5.5999999999999996e-28 < y < 1.60000000000000009e64Initial program 99.9%
Taylor expanded in y around 0 93.1%
Taylor expanded in z around 0 72.9%
Final simplification80.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ t (* 2.0 y)))))
(if (<= t -2.4e+94)
t_1
(if (<= t -4.3e-106)
(* y 5.0)
(if (<= t 1.05e+30) (* x (* 2.0 (+ y z))) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t + (2.0 * y));
double tmp;
if (t <= -2.4e+94) {
tmp = t_1;
} else if (t <= -4.3e-106) {
tmp = y * 5.0;
} else if (t <= 1.05e+30) {
tmp = x * (2.0 * (y + z));
} 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 * (t + (2.0d0 * y))
if (t <= (-2.4d+94)) then
tmp = t_1
else if (t <= (-4.3d-106)) then
tmp = y * 5.0d0
else if (t <= 1.05d+30) then
tmp = x * (2.0d0 * (y + z))
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 * (t + (2.0 * y));
double tmp;
if (t <= -2.4e+94) {
tmp = t_1;
} else if (t <= -4.3e-106) {
tmp = y * 5.0;
} else if (t <= 1.05e+30) {
tmp = x * (2.0 * (y + z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t + (2.0 * y)) tmp = 0 if t <= -2.4e+94: tmp = t_1 elif t <= -4.3e-106: tmp = y * 5.0 elif t <= 1.05e+30: tmp = x * (2.0 * (y + z)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t + Float64(2.0 * y))) tmp = 0.0 if (t <= -2.4e+94) tmp = t_1; elseif (t <= -4.3e-106) tmp = Float64(y * 5.0); elseif (t <= 1.05e+30) tmp = Float64(x * Float64(2.0 * Float64(y + z))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t + (2.0 * y)); tmp = 0.0; if (t <= -2.4e+94) tmp = t_1; elseif (t <= -4.3e-106) tmp = y * 5.0; elseif (t <= 1.05e+30) tmp = x * (2.0 * (y + z)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t + N[(2.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -2.4e+94], t$95$1, If[LessEqual[t, -4.3e-106], N[(y * 5.0), $MachinePrecision], If[LessEqual[t, 1.05e+30], N[(x * N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(t + 2 \cdot y\right)\\
\mathbf{if}\;t \leq -2.4 \cdot 10^{+94}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -4.3 \cdot 10^{-106}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;t \leq 1.05 \cdot 10^{+30}:\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.39999999999999983e94 or 1.05e30 < t Initial program 99.9%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 72.8%
Taylor expanded in z around 0 63.7%
if -2.39999999999999983e94 < t < -4.3000000000000002e-106Initial program 99.8%
Taylor expanded in x around 0 56.4%
if -4.3000000000000002e-106 < t < 1.05e30Initial program 100.0%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 74.8%
Taylor expanded in t around 0 73.5%
associate-*r*73.5%
*-commutative73.5%
associate-*r*73.5%
Simplified73.5%
Final simplification66.7%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.5) (not (<= x 0.000175))) (* x (+ (* 2.0 (+ y z)) t)) (+ (* y 5.0) (* x (+ t (* 2.0 z))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.5) || !(x <= 0.000175)) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = (y * 5.0) + (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 ((x <= (-2.5d0)) .or. (.not. (x <= 0.000175d0))) then
tmp = x * ((2.0d0 * (y + z)) + t)
else
tmp = (y * 5.0d0) + (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 ((x <= -2.5) || !(x <= 0.000175)) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = (y * 5.0) + (x * (t + (2.0 * z)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.5) or not (x <= 0.000175): tmp = x * ((2.0 * (y + z)) + t) else: tmp = (y * 5.0) + (x * (t + (2.0 * z))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.5) || !(x <= 0.000175)) tmp = Float64(x * Float64(Float64(2.0 * Float64(y + z)) + t)); else tmp = Float64(Float64(y * 5.0) + Float64(x * Float64(t + Float64(2.0 * z)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -2.5) || ~((x <= 0.000175))) tmp = x * ((2.0 * (y + z)) + t); else tmp = (y * 5.0) + (x * (t + (2.0 * z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.5], N[Not[LessEqual[x, 0.000175]], $MachinePrecision]], N[(x * N[(N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.5 \lor \neg \left(x \leq 0.000175\right):\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + z\right) + t\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + x \cdot \left(t + 2 \cdot z\right)\\
\end{array}
\end{array}
if x < -2.5 or 1.74999999999999998e-4 < 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 -2.5 < x < 1.74999999999999998e-4Initial program 99.9%
Taylor expanded in y around 0 99.3%
Final simplification99.0%
(FPCore (x y z t)
:precision binary64
(if (<= t -9e+180)
(* x t)
(if (<= t -4.5e-106)
(* y 5.0)
(if (<= t 1.4e+113) (* 2.0 (* x z)) (* x t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -9e+180) {
tmp = x * t;
} else if (t <= -4.5e-106) {
tmp = y * 5.0;
} else if (t <= 1.4e+113) {
tmp = 2.0 * (x * z);
} 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 (t <= (-9d+180)) then
tmp = x * t
else if (t <= (-4.5d-106)) then
tmp = y * 5.0d0
else if (t <= 1.4d+113) then
tmp = 2.0d0 * (x * z)
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 (t <= -9e+180) {
tmp = x * t;
} else if (t <= -4.5e-106) {
tmp = y * 5.0;
} else if (t <= 1.4e+113) {
tmp = 2.0 * (x * z);
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -9e+180: tmp = x * t elif t <= -4.5e-106: tmp = y * 5.0 elif t <= 1.4e+113: tmp = 2.0 * (x * z) else: tmp = x * t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -9e+180) tmp = Float64(x * t); elseif (t <= -4.5e-106) tmp = Float64(y * 5.0); elseif (t <= 1.4e+113) tmp = Float64(2.0 * Float64(x * z)); else tmp = Float64(x * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -9e+180) tmp = x * t; elseif (t <= -4.5e-106) tmp = y * 5.0; elseif (t <= 1.4e+113) tmp = 2.0 * (x * z); else tmp = x * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -9e+180], N[(x * t), $MachinePrecision], If[LessEqual[t, -4.5e-106], N[(y * 5.0), $MachinePrecision], If[LessEqual[t, 1.4e+113], N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], N[(x * t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9 \cdot 10^{+180}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;t \leq -4.5 \cdot 10^{-106}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;t \leq 1.4 \cdot 10^{+113}:\\
\;\;\;\;2 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if t < -8.99999999999999962e180 or 1.39999999999999999e113 < t Initial program 99.9%
Taylor expanded in t around inf 68.1%
Simplified68.1%
if -8.99999999999999962e180 < t < -4.49999999999999955e-106Initial program 99.8%
Taylor expanded in x around 0 51.4%
if -4.49999999999999955e-106 < t < 1.39999999999999999e113Initial program 100.0%
Taylor expanded in z around inf 44.3%
Final simplification53.2%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.3e-41) (not (<= x 1.42e-37))) (* x (+ (* 2.0 (+ y z)) t)) (+ (* y 5.0) (* x t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.3e-41) || !(x <= 1.42e-37)) {
tmp = x * ((2.0 * (y + z)) + t);
} 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 <= (-1.3d-41)) .or. (.not. (x <= 1.42d-37))) then
tmp = x * ((2.0d0 * (y + z)) + t)
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 <= -1.3e-41) || !(x <= 1.42e-37)) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = (y * 5.0) + (x * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.3e-41) or not (x <= 1.42e-37): tmp = x * ((2.0 * (y + z)) + t) else: tmp = (y * 5.0) + (x * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.3e-41) || !(x <= 1.42e-37)) tmp = Float64(x * Float64(Float64(2.0 * Float64(y + z)) + t)); 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 <= -1.3e-41) || ~((x <= 1.42e-37))) tmp = x * ((2.0 * (y + z)) + t); else tmp = (y * 5.0) + (x * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.3e-41], N[Not[LessEqual[x, 1.42e-37]], $MachinePrecision]], N[(x * N[(N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.3 \cdot 10^{-41} \lor \neg \left(x \leq 1.42 \cdot 10^{-37}\right):\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + z\right) + t\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\
\end{array}
\end{array}
if x < -1.3e-41 or 1.42e-37 < 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 95.5%
if -1.3e-41 < x < 1.42e-37Initial program 99.9%
Taylor expanded in y around 0 99.9%
Taylor expanded in z around 0 81.1%
Final simplification88.9%
(FPCore (x y z t) :precision binary64 (if (or (<= y -510000.0) (not (<= y 7.5e+61))) (* 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 <= -510000.0) || !(y <= 7.5e+61)) {
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 <= (-510000.0d0)) .or. (.not. (y <= 7.5d+61))) 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 <= -510000.0) || !(y <= 7.5e+61)) {
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 <= -510000.0) or not (y <= 7.5e+61): 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 <= -510000.0) || !(y <= 7.5e+61)) 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 <= -510000.0) || ~((y <= 7.5e+61))) 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, -510000.0], N[Not[LessEqual[y, 7.5e+61]], $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 -510000 \lor \neg \left(y \leq 7.5 \cdot 10^{+61}\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 < -5.1e5 or 7.5e61 < y Initial program 99.9%
Taylor expanded in y around inf 79.1%
Simplified79.1%
if -5.1e5 < y < 7.5e61Initial program 100.0%
Taylor expanded in y around 0 79.1%
Final simplification79.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.2e-41) (not (<= x 1.8e-34))) (* x (* 2.0 (+ y z))) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.2e-41) || !(x <= 1.8e-34)) {
tmp = x * (2.0 * (y + 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 <= (-2.2d-41)) .or. (.not. (x <= 1.8d-34))) then
tmp = x * (2.0d0 * (y + 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 <= -2.2e-41) || !(x <= 1.8e-34)) {
tmp = x * (2.0 * (y + z));
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.2e-41) or not (x <= 1.8e-34): tmp = x * (2.0 * (y + z)) else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.2e-41) || !(x <= 1.8e-34)) tmp = Float64(x * Float64(2.0 * Float64(y + z))); else tmp = Float64(y * 5.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -2.2e-41) || ~((x <= 1.8e-34))) tmp = x * (2.0 * (y + z)); else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.2e-41], N[Not[LessEqual[x, 1.8e-34]], $MachinePrecision]], N[(x * N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.2 \cdot 10^{-41} \lor \neg \left(x \leq 1.8 \cdot 10^{-34}\right):\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -2.2e-41 or 1.80000000000000004e-34 < 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 95.5%
Taylor expanded in t around 0 66.0%
associate-*r*66.0%
*-commutative66.0%
associate-*r*66.0%
Simplified66.0%
if -2.2e-41 < x < 1.80000000000000004e-34Initial program 99.9%
Taylor expanded in x around 0 60.9%
Final simplification63.7%
(FPCore (x y z t) :precision binary64 (+ (* x (+ t (+ y (+ z (+ y z))))) (* y 5.0)))
double code(double x, double y, double z, double t) {
return (x * (t + (y + (z + (y + z))))) + (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 * (t + (y + (z + (y + z))))) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x * (t + (y + (z + (y + z))))) + (y * 5.0);
}
def code(x, y, z, t): return (x * (t + (y + (z + (y + z))))) + (y * 5.0)
function code(x, y, z, t) return Float64(Float64(x * Float64(t + Float64(y + Float64(z + Float64(y + z))))) + Float64(y * 5.0)) end
function tmp = code(x, y, z, t) tmp = (x * (t + (y + (z + (y + z))))) + (y * 5.0); end
code[x_, y_, z_, t_] := N[(N[(x * N[(t + N[(y + N[(z + N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(t + \left(y + \left(z + \left(y + z\right)\right)\right)\right) + y \cdot 5
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -7.2e-42) (not (<= x 2.85e-74))) (* x t) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -7.2e-42) || !(x <= 2.85e-74)) {
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 <= (-7.2d-42)) .or. (.not. (x <= 2.85d-74))) 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 <= -7.2e-42) || !(x <= 2.85e-74)) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -7.2e-42) or not (x <= 2.85e-74): tmp = x * t else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -7.2e-42) || !(x <= 2.85e-74)) 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 <= -7.2e-42) || ~((x <= 2.85e-74))) tmp = x * t; else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -7.2e-42], N[Not[LessEqual[x, 2.85e-74]], $MachinePrecision]], N[(x * t), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{-42} \lor \neg \left(x \leq 2.85 \cdot 10^{-74}\right):\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -7.2000000000000004e-42 or 2.85000000000000012e-74 < x Initial program 100.0%
Taylor expanded in t around inf 38.7%
Simplified38.7%
if -7.2000000000000004e-42 < x < 2.85000000000000012e-74Initial program 99.9%
Taylor expanded in x around 0 63.6%
Final simplification49.2%
(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.6%
Final simplification30.6%
herbie shell --seed 2024135
(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)))