
(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-def99.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 (+ y z)))))
(if (<= x -3e-102)
t_1
(if (<= x 6e-64)
(* y 5.0)
(if (or (<= x 4.5e+58) (and (not (<= x 3.1e+155)) (<= x 2.1e+208)))
(* x t)
t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (x * (y + z));
double tmp;
if (x <= -3e-102) {
tmp = t_1;
} else if (x <= 6e-64) {
tmp = y * 5.0;
} else if ((x <= 4.5e+58) || (!(x <= 3.1e+155) && (x <= 2.1e+208))) {
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 * (y + z))
if (x <= (-3d-102)) then
tmp = t_1
else if (x <= 6d-64) then
tmp = y * 5.0d0
else if ((x <= 4.5d+58) .or. (.not. (x <= 3.1d+155)) .and. (x <= 2.1d+208)) 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 * (y + z));
double tmp;
if (x <= -3e-102) {
tmp = t_1;
} else if (x <= 6e-64) {
tmp = y * 5.0;
} else if ((x <= 4.5e+58) || (!(x <= 3.1e+155) && (x <= 2.1e+208))) {
tmp = x * t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = 2.0 * (x * (y + z)) tmp = 0 if x <= -3e-102: tmp = t_1 elif x <= 6e-64: tmp = y * 5.0 elif (x <= 4.5e+58) or (not (x <= 3.1e+155) and (x <= 2.1e+208)): tmp = x * t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(2.0 * Float64(x * Float64(y + z))) tmp = 0.0 if (x <= -3e-102) tmp = t_1; elseif (x <= 6e-64) tmp = Float64(y * 5.0); elseif ((x <= 4.5e+58) || (!(x <= 3.1e+155) && (x <= 2.1e+208))) 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 * (y + z)); tmp = 0.0; if (x <= -3e-102) tmp = t_1; elseif (x <= 6e-64) tmp = y * 5.0; elseif ((x <= 4.5e+58) || (~((x <= 3.1e+155)) && (x <= 2.1e+208))) 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 * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3e-102], t$95$1, If[LessEqual[x, 6e-64], N[(y * 5.0), $MachinePrecision], If[Or[LessEqual[x, 4.5e+58], And[N[Not[LessEqual[x, 3.1e+155]], $MachinePrecision], LessEqual[x, 2.1e+208]]], N[(x * t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(x \cdot \left(y + z\right)\right)\\
\mathbf{if}\;x \leq -3 \cdot 10^{-102}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 6 \cdot 10^{-64}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{+58} \lor \neg \left(x \leq 3.1 \cdot 10^{+155}\right) \land x \leq 2.1 \cdot 10^{+208}:\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -3e-102 or 4.4999999999999998e58 < x < 3.09999999999999989e155 or 2.0999999999999998e208 < x Initial program 100.0%
Taylor expanded in t around 0 75.2%
Simplified75.2%
Taylor expanded in x around inf 70.0%
if -3e-102 < x < 6.0000000000000001e-64Initial program 99.9%
Taylor expanded in x around 0 66.5%
if 6.0000000000000001e-64 < x < 4.4999999999999998e58 or 3.09999999999999989e155 < x < 2.0999999999999998e208Initial program 100.0%
Taylor expanded in t around inf 60.5%
Simplified60.5%
Final simplification67.2%
(FPCore (x y z t)
:precision binary64
(if (<= y -1.65e+47)
(* y 5.0)
(if (<= y 3.55e+81)
(* x (+ t (* 2.0 z)))
(if (or (<= y 3.3e+125) (not (<= y 4.6e+218)))
(* y 5.0)
(* 2.0 (* x (+ y z)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.65e+47) {
tmp = y * 5.0;
} else if (y <= 3.55e+81) {
tmp = x * (t + (2.0 * z));
} else if ((y <= 3.3e+125) || !(y <= 4.6e+218)) {
tmp = y * 5.0;
} else {
tmp = 2.0 * (x * (y + 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 <= (-1.65d+47)) then
tmp = y * 5.0d0
else if (y <= 3.55d+81) then
tmp = x * (t + (2.0d0 * z))
else if ((y <= 3.3d+125) .or. (.not. (y <= 4.6d+218))) then
tmp = y * 5.0d0
else
tmp = 2.0d0 * (x * (y + z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.65e+47) {
tmp = y * 5.0;
} else if (y <= 3.55e+81) {
tmp = x * (t + (2.0 * z));
} else if ((y <= 3.3e+125) || !(y <= 4.6e+218)) {
tmp = y * 5.0;
} else {
tmp = 2.0 * (x * (y + z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.65e+47: tmp = y * 5.0 elif y <= 3.55e+81: tmp = x * (t + (2.0 * z)) elif (y <= 3.3e+125) or not (y <= 4.6e+218): tmp = y * 5.0 else: tmp = 2.0 * (x * (y + z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.65e+47) tmp = Float64(y * 5.0); elseif (y <= 3.55e+81) tmp = Float64(x * Float64(t + Float64(2.0 * z))); elseif ((y <= 3.3e+125) || !(y <= 4.6e+218)) tmp = Float64(y * 5.0); else tmp = Float64(2.0 * Float64(x * Float64(y + z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.65e+47) tmp = y * 5.0; elseif (y <= 3.55e+81) tmp = x * (t + (2.0 * z)); elseif ((y <= 3.3e+125) || ~((y <= 4.6e+218))) tmp = y * 5.0; else tmp = 2.0 * (x * (y + z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.65e+47], N[(y * 5.0), $MachinePrecision], If[LessEqual[y, 3.55e+81], N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, 3.3e+125], N[Not[LessEqual[y, 4.6e+218]], $MachinePrecision]], N[(y * 5.0), $MachinePrecision], N[(2.0 * N[(x * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.65 \cdot 10^{+47}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;y \leq 3.55 \cdot 10^{+81}:\\
\;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\
\mathbf{elif}\;y \leq 3.3 \cdot 10^{+125} \lor \neg \left(y \leq 4.6 \cdot 10^{+218}\right):\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right)\\
\end{array}
\end{array}
if y < -1.65e47 or 3.54999999999999984e81 < y < 3.30000000000000005e125 or 4.6000000000000002e218 < y Initial program 99.8%
Taylor expanded in x around 0 63.2%
if -1.65e47 < y < 3.54999999999999984e81Initial program 100.0%
Taylor expanded in y around 0 81.8%
if 3.30000000000000005e125 < y < 4.6000000000000002e218Initial program 99.9%
Taylor expanded in t around 0 85.7%
Simplified85.7%
Taylor expanded in x around inf 63.5%
Final simplification74.5%
(FPCore (x y z t) :precision binary64 (if (or (<= x -65.0) (not (<= x 2.0))) (* x (+ (* 2.0 (+ y z)) t)) (+ (* x (+ t (* 2.0 z))) (* y 5.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -65.0) || !(x <= 2.0)) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = (x * (t + (2.0 * z))) + (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 <= (-65.0d0)) .or. (.not. (x <= 2.0d0))) then
tmp = x * ((2.0d0 * (y + z)) + t)
else
tmp = (x * (t + (2.0d0 * z))) + (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 <= -65.0) || !(x <= 2.0)) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = (x * (t + (2.0 * z))) + (y * 5.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -65.0) or not (x <= 2.0): tmp = x * ((2.0 * (y + z)) + t) else: tmp = (x * (t + (2.0 * z))) + (y * 5.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -65.0) || !(x <= 2.0)) tmp = Float64(x * Float64(Float64(2.0 * Float64(y + z)) + t)); else tmp = Float64(Float64(x * Float64(t + Float64(2.0 * z))) + Float64(y * 5.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -65.0) || ~((x <= 2.0))) tmp = x * ((2.0 * (y + z)) + t); else tmp = (x * (t + (2.0 * z))) + (y * 5.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -65.0], N[Not[LessEqual[x, 2.0]], $MachinePrecision]], N[(x * N[(N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -65 \lor \neg \left(x \leq 2\right):\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + z\right) + t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + 2 \cdot z\right) + y \cdot 5\\
\end{array}
\end{array}
if x < -65 or 2 < x Initial program 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 98.9%
if -65 < x < 2Initial program 99.9%
Taylor expanded in y around 0 98.6%
Final simplification98.7%
(FPCore (x y z t) :precision binary64 (+ (* x (+ t (+ y (+ y (* 2.0 z))))) (* y 5.0)))
double code(double x, double y, double z, double t) {
return (x * (t + (y + (y + (2.0 * 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 + (y + (2.0d0 * z))))) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x * (t + (y + (y + (2.0 * z))))) + (y * 5.0);
}
def code(x, y, z, t): return (x * (t + (y + (y + (2.0 * z))))) + (y * 5.0)
function code(x, y, z, t) return Float64(Float64(x * Float64(t + Float64(y + Float64(y + Float64(2.0 * z))))) + Float64(y * 5.0)) end
function tmp = code(x, y, z, t) tmp = (x * (t + (y + (y + (2.0 * z))))) + (y * 5.0); end
code[x_, y_, z_, t_] := N[(N[(x * N[(t + N[(y + N[(y + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(t + \left(y + \left(y + 2 \cdot z\right)\right)\right) + y \cdot 5
\end{array}
Initial program 99.9%
Taylor expanded in y around 0 99.9%
Final simplification99.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 2.0 (* x z))))
(if (<= x -2.4e+151)
(* 2.0 (* x y))
(if (<= x -2.8e-102)
t_1
(if (<= x 4.5e-64) (* y 5.0) (if (<= x 1.15e+209) (* 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 <= -2.4e+151) {
tmp = 2.0 * (x * y);
} else if (x <= -2.8e-102) {
tmp = t_1;
} else if (x <= 4.5e-64) {
tmp = y * 5.0;
} else if (x <= 1.15e+209) {
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 <= (-2.4d+151)) then
tmp = 2.0d0 * (x * y)
else if (x <= (-2.8d-102)) then
tmp = t_1
else if (x <= 4.5d-64) then
tmp = y * 5.0d0
else if (x <= 1.15d+209) 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 <= -2.4e+151) {
tmp = 2.0 * (x * y);
} else if (x <= -2.8e-102) {
tmp = t_1;
} else if (x <= 4.5e-64) {
tmp = y * 5.0;
} else if (x <= 1.15e+209) {
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 <= -2.4e+151: tmp = 2.0 * (x * y) elif x <= -2.8e-102: tmp = t_1 elif x <= 4.5e-64: tmp = y * 5.0 elif x <= 1.15e+209: 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 <= -2.4e+151) tmp = Float64(2.0 * Float64(x * y)); elseif (x <= -2.8e-102) tmp = t_1; elseif (x <= 4.5e-64) tmp = Float64(y * 5.0); elseif (x <= 1.15e+209) 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 <= -2.4e+151) tmp = 2.0 * (x * y); elseif (x <= -2.8e-102) tmp = t_1; elseif (x <= 4.5e-64) tmp = y * 5.0; elseif (x <= 1.15e+209) 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, -2.4e+151], N[(2.0 * N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.8e-102], t$95$1, If[LessEqual[x, 4.5e-64], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 1.15e+209], 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 -2.4 \cdot 10^{+151}:\\
\;\;\;\;2 \cdot \left(x \cdot y\right)\\
\mathbf{elif}\;x \leq -2.8 \cdot 10^{-102}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{-64}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{+209}:\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -2.4000000000000001e151Initial program 99.9%
Taylor expanded in t around 0 70.0%
Simplified70.0%
Taylor expanded in x around inf 70.0%
Taylor expanded in y around inf 44.1%
if -2.4000000000000001e151 < x < -2.80000000000000013e-102 or 1.15000000000000005e209 < x Initial program 100.0%
Taylor expanded in z around inf 56.0%
if -2.80000000000000013e-102 < x < 4.5000000000000001e-64Initial program 99.9%
Taylor expanded in x around 0 66.5%
if 4.5000000000000001e-64 < x < 1.15000000000000005e209Initial program 100.0%
Taylor expanded in t around inf 53.4%
Simplified53.4%
Final simplification58.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3e-102) (not (<= x 2.2e-26))) (* x (+ (* 2.0 (+ y z)) t)) (+ (* x t) (* y 5.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3e-102) || !(x <= 2.2e-26)) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = (x * t) + (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 <= (-3d-102)) .or. (.not. (x <= 2.2d-26))) then
tmp = x * ((2.0d0 * (y + z)) + t)
else
tmp = (x * t) + (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 <= -3e-102) || !(x <= 2.2e-26)) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = (x * t) + (y * 5.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3e-102) or not (x <= 2.2e-26): tmp = x * ((2.0 * (y + z)) + t) else: tmp = (x * t) + (y * 5.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -3e-102) || !(x <= 2.2e-26)) tmp = Float64(x * Float64(Float64(2.0 * Float64(y + z)) + t)); else tmp = Float64(Float64(x * t) + Float64(y * 5.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -3e-102) || ~((x <= 2.2e-26))) tmp = x * ((2.0 * (y + z)) + t); else tmp = (x * t) + (y * 5.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -3e-102], N[Not[LessEqual[x, 2.2e-26]], $MachinePrecision]], N[(x * N[(N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision], N[(N[(x * t), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3 \cdot 10^{-102} \lor \neg \left(x \leq 2.2 \cdot 10^{-26}\right):\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + z\right) + t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot t + y \cdot 5\\
\end{array}
\end{array}
if x < -3e-102 or 2.2000000000000001e-26 < x Initial program 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 93.2%
if -3e-102 < x < 2.2000000000000001e-26Initial program 99.9%
Taylor expanded in y around 0 99.9%
Taylor expanded in t around inf 84.5%
Final simplification89.4%
(FPCore (x y z t) :precision binary64 (if (or (<= y -8.5e+44) (not (<= y 3.2e+50))) (* 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 <= -8.5e+44) || !(y <= 3.2e+50)) {
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 <= (-8.5d+44)) .or. (.not. (y <= 3.2d+50))) 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 <= -8.5e+44) || !(y <= 3.2e+50)) {
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 <= -8.5e+44) or not (y <= 3.2e+50): 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 <= -8.5e+44) || !(y <= 3.2e+50)) 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 <= -8.5e+44) || ~((y <= 3.2e+50))) 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, -8.5e+44], N[Not[LessEqual[y, 3.2e+50]], $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 -8.5 \cdot 10^{+44} \lor \neg \left(y \leq 3.2 \cdot 10^{+50}\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 < -8.5e44 or 3.19999999999999983e50 < y Initial program 99.9%
Taylor expanded in y around inf 85.9%
Simplified85.9%
if -8.5e44 < y < 3.19999999999999983e50Initial program 100.0%
Taylor expanded in y around 0 82.9%
Final simplification84.2%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3e-45) (not (<= x 6e-64))) (* x t) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3e-45) || !(x <= 6e-64)) {
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 <= (-3d-45)) .or. (.not. (x <= 6d-64))) 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 <= -3e-45) || !(x <= 6e-64)) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3e-45) or not (x <= 6e-64): tmp = x * t else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -3e-45) || !(x <= 6e-64)) 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 <= -3e-45) || ~((x <= 6e-64))) tmp = x * t; else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -3e-45], N[Not[LessEqual[x, 6e-64]], $MachinePrecision]], N[(x * t), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3 \cdot 10^{-45} \lor \neg \left(x \leq 6 \cdot 10^{-64}\right):\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -3.00000000000000011e-45 or 6.0000000000000001e-64 < x Initial program 100.0%
Taylor expanded in t around inf 39.2%
Simplified39.2%
if -3.00000000000000011e-45 < x < 6.0000000000000001e-64Initial program 99.9%
Taylor expanded in x around 0 61.9%
Final simplification49.1%
(FPCore (x y z t) :precision binary64 (if (<= x -65.0) (* 2.0 (* x y)) (if (<= x 2.8e-64) (* y 5.0) (* x t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -65.0) {
tmp = 2.0 * (x * y);
} else if (x <= 2.8e-64) {
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 <= (-65.0d0)) then
tmp = 2.0d0 * (x * y)
else if (x <= 2.8d-64) 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 <= -65.0) {
tmp = 2.0 * (x * y);
} else if (x <= 2.8e-64) {
tmp = y * 5.0;
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -65.0: tmp = 2.0 * (x * y) elif x <= 2.8e-64: tmp = y * 5.0 else: tmp = x * t return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -65.0) tmp = Float64(2.0 * Float64(x * y)); elseif (x <= 2.8e-64) 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 <= -65.0) tmp = 2.0 * (x * y); elseif (x <= 2.8e-64) tmp = y * 5.0; else tmp = x * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -65.0], N[(2.0 * N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.8e-64], N[(y * 5.0), $MachinePrecision], N[(x * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -65:\\
\;\;\;\;2 \cdot \left(x \cdot y\right)\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{-64}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if x < -65Initial program 99.9%
Taylor expanded in t around 0 76.1%
Simplified76.1%
Taylor expanded in x around inf 73.9%
Taylor expanded in y around inf 34.9%
if -65 < x < 2.80000000000000004e-64Initial program 99.9%
Taylor expanded in x around 0 59.1%
if 2.80000000000000004e-64 < x Initial program 100.0%
Taylor expanded in t around inf 47.9%
Simplified47.9%
Final simplification50.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 31.3%
Final simplification31.3%
herbie shell --seed 2023314
(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)))