
(FPCore (x y z t) :precision binary64 (+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5.0)))
double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * ((((y + z) + z) + y) + t)) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
def code(x, y, z, t): return (x * ((((y + z) + z) + y) + t)) + (y * 5.0)
function code(x, y, z, t) return Float64(Float64(x * Float64(Float64(Float64(Float64(y + z) + z) + y) + t)) + Float64(y * 5.0)) end
function tmp = code(x, y, z, t) tmp = (x * ((((y + z) + z) + y) + t)) + (y * 5.0); end
code[x_, y_, z_, t_] := N[(N[(x * N[(N[(N[(N[(y + z), $MachinePrecision] + z), $MachinePrecision] + y), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5.0)))
double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * ((((y + z) + z) + y) + t)) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
def code(x, y, z, t): return (x * ((((y + z) + z) + y) + t)) + (y * 5.0)
function code(x, y, z, t) return Float64(Float64(x * Float64(Float64(Float64(Float64(y + z) + z) + y) + t)) + Float64(y * 5.0)) end
function tmp = code(x, y, z, t) tmp = (x * ((((y + z) + z) + y) + t)) + (y * 5.0); end
code[x_, y_, z_, t_] := N[(N[(x * N[(N[(N[(N[(y + z), $MachinePrecision] + z), $MachinePrecision] + y), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5
\end{array}
(FPCore (x y z t) :precision binary64 (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 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (* x 2.0))))
(if (<= z -1.75e+73)
t_1
(if (<= z -7e-257)
(* y 5.0)
(if (<= z 6.6e-308)
(* x t)
(if (<= z 1.7e-176)
(* y 5.0)
(if (<= z 1.85e-59)
(* x (* 2.0 y))
(if (<= z 5.6e+71) (* x t) t_1))))))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x * 2.0);
double tmp;
if (z <= -1.75e+73) {
tmp = t_1;
} else if (z <= -7e-257) {
tmp = y * 5.0;
} else if (z <= 6.6e-308) {
tmp = x * t;
} else if (z <= 1.7e-176) {
tmp = y * 5.0;
} else if (z <= 1.85e-59) {
tmp = x * (2.0 * y);
} else if (z <= 5.6e+71) {
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 = z * (x * 2.0d0)
if (z <= (-1.75d+73)) then
tmp = t_1
else if (z <= (-7d-257)) then
tmp = y * 5.0d0
else if (z <= 6.6d-308) then
tmp = x * t
else if (z <= 1.7d-176) then
tmp = y * 5.0d0
else if (z <= 1.85d-59) then
tmp = x * (2.0d0 * y)
else if (z <= 5.6d+71) 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 = z * (x * 2.0);
double tmp;
if (z <= -1.75e+73) {
tmp = t_1;
} else if (z <= -7e-257) {
tmp = y * 5.0;
} else if (z <= 6.6e-308) {
tmp = x * t;
} else if (z <= 1.7e-176) {
tmp = y * 5.0;
} else if (z <= 1.85e-59) {
tmp = x * (2.0 * y);
} else if (z <= 5.6e+71) {
tmp = x * t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (x * 2.0) tmp = 0 if z <= -1.75e+73: tmp = t_1 elif z <= -7e-257: tmp = y * 5.0 elif z <= 6.6e-308: tmp = x * t elif z <= 1.7e-176: tmp = y * 5.0 elif z <= 1.85e-59: tmp = x * (2.0 * y) elif z <= 5.6e+71: tmp = x * t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(x * 2.0)) tmp = 0.0 if (z <= -1.75e+73) tmp = t_1; elseif (z <= -7e-257) tmp = Float64(y * 5.0); elseif (z <= 6.6e-308) tmp = Float64(x * t); elseif (z <= 1.7e-176) tmp = Float64(y * 5.0); elseif (z <= 1.85e-59) tmp = Float64(x * Float64(2.0 * y)); elseif (z <= 5.6e+71) tmp = Float64(x * t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * (x * 2.0); tmp = 0.0; if (z <= -1.75e+73) tmp = t_1; elseif (z <= -7e-257) tmp = y * 5.0; elseif (z <= 6.6e-308) tmp = x * t; elseif (z <= 1.7e-176) tmp = y * 5.0; elseif (z <= 1.85e-59) tmp = x * (2.0 * y); elseif (z <= 5.6e+71) tmp = x * t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(x * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.75e+73], t$95$1, If[LessEqual[z, -7e-257], N[(y * 5.0), $MachinePrecision], If[LessEqual[z, 6.6e-308], N[(x * t), $MachinePrecision], If[LessEqual[z, 1.7e-176], N[(y * 5.0), $MachinePrecision], If[LessEqual[z, 1.85e-59], N[(x * N[(2.0 * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.6e+71], N[(x * t), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(x \cdot 2\right)\\
\mathbf{if}\;z \leq -1.75 \cdot 10^{+73}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -7 \cdot 10^{-257}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;z \leq 6.6 \cdot 10^{-308}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{-176}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;z \leq 1.85 \cdot 10^{-59}:\\
\;\;\;\;x \cdot \left(2 \cdot y\right)\\
\mathbf{elif}\;z \leq 5.6 \cdot 10^{+71}:\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.75000000000000001e73 or 5.60000000000000004e71 < z Initial program 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 81.2%
Taylor expanded in z around inf 61.2%
associate-*r*61.2%
Simplified61.2%
if -1.75000000000000001e73 < z < -7.00000000000000058e-257 or 6.5999999999999996e-308 < z < 1.6999999999999999e-176Initial program 99.9%
Taylor expanded in x around 0 45.7%
Simplified45.7%
if -7.00000000000000058e-257 < z < 6.5999999999999996e-308 or 1.85e-59 < z < 5.60000000000000004e71Initial program 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 75.7%
Taylor expanded in t around inf 58.9%
*-commutative58.9%
Simplified58.9%
if 1.6999999999999999e-176 < z < 1.85e-59Initial program 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 83.9%
Taylor expanded in y around inf 51.6%
associate-*r*51.6%
*-commutative51.6%
associate-*r*51.6%
Simplified51.6%
Final simplification54.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (* 2.0 y))))
(if (<= x -4.5e+183)
(* x t)
(if (<= x -1.7e+107)
t_1
(if (<= x -1.5e-86)
(* x t)
(if (<= x 1.1e-36) (* y 5.0) (if (<= x 480.0) (* x t) t_1)))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (2.0 * y);
double tmp;
if (x <= -4.5e+183) {
tmp = x * t;
} else if (x <= -1.7e+107) {
tmp = t_1;
} else if (x <= -1.5e-86) {
tmp = x * t;
} else if (x <= 1.1e-36) {
tmp = y * 5.0;
} else if (x <= 480.0) {
tmp = x * t;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x * (2.0d0 * y)
if (x <= (-4.5d+183)) then
tmp = x * t
else if (x <= (-1.7d+107)) then
tmp = t_1
else if (x <= (-1.5d-86)) then
tmp = x * t
else if (x <= 1.1d-36) then
tmp = y * 5.0d0
else if (x <= 480.0d0) then
tmp = x * t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (2.0 * y);
double tmp;
if (x <= -4.5e+183) {
tmp = x * t;
} else if (x <= -1.7e+107) {
tmp = t_1;
} else if (x <= -1.5e-86) {
tmp = x * t;
} else if (x <= 1.1e-36) {
tmp = y * 5.0;
} else if (x <= 480.0) {
tmp = x * t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (2.0 * y) tmp = 0 if x <= -4.5e+183: tmp = x * t elif x <= -1.7e+107: tmp = t_1 elif x <= -1.5e-86: tmp = x * t elif x <= 1.1e-36: tmp = y * 5.0 elif x <= 480.0: tmp = x * t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(2.0 * y)) tmp = 0.0 if (x <= -4.5e+183) tmp = Float64(x * t); elseif (x <= -1.7e+107) tmp = t_1; elseif (x <= -1.5e-86) tmp = Float64(x * t); elseif (x <= 1.1e-36) tmp = Float64(y * 5.0); elseif (x <= 480.0) tmp = 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); tmp = 0.0; if (x <= -4.5e+183) tmp = x * t; elseif (x <= -1.7e+107) tmp = t_1; elseif (x <= -1.5e-86) tmp = x * t; elseif (x <= 1.1e-36) tmp = y * 5.0; elseif (x <= 480.0) tmp = x * t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(2.0 * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4.5e+183], N[(x * t), $MachinePrecision], If[LessEqual[x, -1.7e+107], t$95$1, If[LessEqual[x, -1.5e-86], N[(x * t), $MachinePrecision], If[LessEqual[x, 1.1e-36], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 480.0], N[(x * t), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(2 \cdot y\right)\\
\mathbf{if}\;x \leq -4.5 \cdot 10^{+183}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq -1.7 \cdot 10^{+107}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -1.5 \cdot 10^{-86}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{-36}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 480:\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -4.50000000000000017e183 or -1.6999999999999998e107 < x < -1.5e-86 or 1.1e-36 < x < 480Initial program 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 93.3%
Taylor expanded in t around inf 50.1%
*-commutative50.1%
Simplified50.1%
if -4.50000000000000017e183 < x < -1.6999999999999998e107 or 480 < 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 97.0%
Taylor expanded in y around inf 47.3%
associate-*r*47.3%
*-commutative47.3%
associate-*r*47.3%
Simplified47.3%
if -1.5e-86 < x < 1.1e-36Initial program 100.0%
Taylor expanded in x around 0 60.4%
Simplified60.4%
Final simplification53.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ (* 2.0 (+ y z)) t))))
(if (<= x -1.15e-73)
t_1
(if (<= x 8e-295)
(+ (* y 5.0) (* x t))
(if (<= x 7.5e-44) (+ (* y 5.0) (* 2.0 (* x z))) 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.15e-73) {
tmp = t_1;
} else if (x <= 8e-295) {
tmp = (y * 5.0) + (x * t);
} else if (x <= 7.5e-44) {
tmp = (y * 5.0) + (2.0 * (x * 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 * ((2.0d0 * (y + z)) + t)
if (x <= (-1.15d-73)) then
tmp = t_1
else if (x <= 8d-295) then
tmp = (y * 5.0d0) + (x * t)
else if (x <= 7.5d-44) then
tmp = (y * 5.0d0) + (2.0d0 * (x * 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 * ((2.0 * (y + z)) + t);
double tmp;
if (x <= -1.15e-73) {
tmp = t_1;
} else if (x <= 8e-295) {
tmp = (y * 5.0) + (x * t);
} else if (x <= 7.5e-44) {
tmp = (y * 5.0) + (2.0 * (x * z));
} 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.15e-73: tmp = t_1 elif x <= 8e-295: tmp = (y * 5.0) + (x * t) elif x <= 7.5e-44: tmp = (y * 5.0) + (2.0 * (x * z)) 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.15e-73) tmp = t_1; elseif (x <= 8e-295) tmp = Float64(Float64(y * 5.0) + Float64(x * t)); elseif (x <= 7.5e-44) tmp = Float64(Float64(y * 5.0) + Float64(2.0 * Float64(x * z))); 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.15e-73) tmp = t_1; elseif (x <= 8e-295) tmp = (y * 5.0) + (x * t); elseif (x <= 7.5e-44) tmp = (y * 5.0) + (2.0 * (x * z)); 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.15e-73], t$95$1, If[LessEqual[x, 8e-295], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7.5e-44], N[(N[(y * 5.0), $MachinePrecision] + N[(2.0 * N[(x * z), $MachinePrecision]), $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 -1.15 \cdot 10^{-73}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 8 \cdot 10^{-295}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{-44}:\\
\;\;\;\;y \cdot 5 + 2 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.14999999999999994e-73 or 7.50000000000000008e-44 < 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 95.8%
if -1.14999999999999994e-73 < x < 8.00000000000000048e-295Initial program 100.0%
Taylor expanded in t around inf 87.6%
if 8.00000000000000048e-295 < x < 7.50000000000000008e-44Initial program 100.0%
Taylor expanded in z around inf 85.1%
Final simplification91.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ t (* 2.0 y)))))
(if (<= x -60000000000.0)
t_1
(if (<= x -1.45e-79) (* z (* x 2.0)) (if (<= x 3.3e-46) (* y 5.0) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t + (2.0 * y));
double tmp;
if (x <= -60000000000.0) {
tmp = t_1;
} else if (x <= -1.45e-79) {
tmp = z * (x * 2.0);
} else if (x <= 3.3e-46) {
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 * (t + (2.0d0 * y))
if (x <= (-60000000000.0d0)) then
tmp = t_1
else if (x <= (-1.45d-79)) then
tmp = z * (x * 2.0d0)
else if (x <= 3.3d-46) 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 * (t + (2.0 * y));
double tmp;
if (x <= -60000000000.0) {
tmp = t_1;
} else if (x <= -1.45e-79) {
tmp = z * (x * 2.0);
} else if (x <= 3.3e-46) {
tmp = y * 5.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t + (2.0 * y)) tmp = 0 if x <= -60000000000.0: tmp = t_1 elif x <= -1.45e-79: tmp = z * (x * 2.0) elif x <= 3.3e-46: tmp = y * 5.0 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 (x <= -60000000000.0) tmp = t_1; elseif (x <= -1.45e-79) tmp = Float64(z * Float64(x * 2.0)); elseif (x <= 3.3e-46) tmp = Float64(y * 5.0); 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 (x <= -60000000000.0) tmp = t_1; elseif (x <= -1.45e-79) tmp = z * (x * 2.0); elseif (x <= 3.3e-46) 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[(t + N[(2.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -60000000000.0], t$95$1, If[LessEqual[x, -1.45e-79], N[(z * N[(x * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.3e-46], N[(y * 5.0), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(t + 2 \cdot y\right)\\
\mathbf{if}\;x \leq -60000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -1.45 \cdot 10^{-79}:\\
\;\;\;\;z \cdot \left(x \cdot 2\right)\\
\mathbf{elif}\;x \leq 3.3 \cdot 10^{-46}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -6e10 or 3.30000000000000013e-46 < 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 96.9%
Taylor expanded in z around 0 72.0%
if -6e10 < x < -1.45e-79Initial program 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 87.7%
Taylor expanded in z around inf 63.9%
associate-*r*63.9%
Simplified63.9%
if -1.45e-79 < x < 3.30000000000000013e-46Initial program 100.0%
Taylor expanded in x around 0 60.2%
Simplified60.2%
Final simplification66.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (+ 5.0 (* x 2.0)))))
(if (<= y -1.9e+23)
t_1
(if (<= y 4e-66)
(* x (+ t (* 2.0 z)))
(if (<= y 1e+96) (+ (* 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 <= -1.9e+23) {
tmp = t_1;
} else if (y <= 4e-66) {
tmp = x * (t + (2.0 * z));
} else if (y <= 1e+96) {
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 <= (-1.9d+23)) then
tmp = t_1
else if (y <= 4d-66) then
tmp = x * (t + (2.0d0 * z))
else if (y <= 1d+96) 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 <= -1.9e+23) {
tmp = t_1;
} else if (y <= 4e-66) {
tmp = x * (t + (2.0 * z));
} else if (y <= 1e+96) {
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 <= -1.9e+23: tmp = t_1 elif y <= 4e-66: tmp = x * (t + (2.0 * z)) elif y <= 1e+96: 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 <= -1.9e+23) tmp = t_1; elseif (y <= 4e-66) tmp = Float64(x * Float64(t + Float64(2.0 * z))); elseif (y <= 1e+96) 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 <= -1.9e+23) tmp = t_1; elseif (y <= 4e-66) tmp = x * (t + (2.0 * z)); elseif (y <= 1e+96) 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, -1.9e+23], t$95$1, If[LessEqual[y, 4e-66], N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1e+96], 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 -1.9 \cdot 10^{+23}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 4 \cdot 10^{-66}:\\
\;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\
\mathbf{elif}\;y \leq 10^{+96}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.89999999999999987e23 or 1.00000000000000005e96 < y Initial program 100.0%
Taylor expanded in y around inf 85.5%
if -1.89999999999999987e23 < y < 3.9999999999999999e-66Initial program 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 86.0%
Taylor expanded in y around 0 82.8%
if 3.9999999999999999e-66 < y < 1.00000000000000005e96Initial program 100.0%
Taylor expanded in t around inf 68.6%
Final simplification81.4%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4.5e-75) (not (<= x 1.5e-53))) (* 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 <= -4.5e-75) || !(x <= 1.5e-53)) {
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 <= (-4.5d-75)) .or. (.not. (x <= 1.5d-53))) 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 <= -4.5e-75) || !(x <= 1.5e-53)) {
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 <= -4.5e-75) or not (x <= 1.5e-53): 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 <= -4.5e-75) || !(x <= 1.5e-53)) 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 <= -4.5e-75) || ~((x <= 1.5e-53))) 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, -4.5e-75], N[Not[LessEqual[x, 1.5e-53]], $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 -4.5 \cdot 10^{-75} \lor \neg \left(x \leq 1.5 \cdot 10^{-53}\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 < -4.5000000000000003e-75 or 1.5000000000000001e-53 < 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 95.8%
if -4.5000000000000003e-75 < x < 1.5000000000000001e-53Initial program 100.0%
Taylor expanded in t around inf 78.2%
Final simplification88.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5.6e-49) (not (<= z 3e+46))) (* x (+ t (* 2.0 z))) (* x (+ t (* 2.0 y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.6e-49) || !(z <= 3e+46)) {
tmp = x * (t + (2.0 * z));
} else {
tmp = x * (t + (2.0 * 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) :: tmp
if ((z <= (-5.6d-49)) .or. (.not. (z <= 3d+46))) then
tmp = x * (t + (2.0d0 * z))
else
tmp = x * (t + (2.0d0 * y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.6e-49) || !(z <= 3e+46)) {
tmp = x * (t + (2.0 * z));
} else {
tmp = x * (t + (2.0 * y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5.6e-49) or not (z <= 3e+46): tmp = x * (t + (2.0 * z)) else: tmp = x * (t + (2.0 * y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5.6e-49) || !(z <= 3e+46)) tmp = Float64(x * Float64(t + Float64(2.0 * z))); else tmp = Float64(x * Float64(t + Float64(2.0 * y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -5.6e-49) || ~((z <= 3e+46))) tmp = x * (t + (2.0 * z)); else tmp = x * (t + (2.0 * y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5.6e-49], N[Not[LessEqual[z, 3e+46]], $MachinePrecision]], N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(t + N[(2.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.6 \cdot 10^{-49} \lor \neg \left(z \leq 3 \cdot 10^{+46}\right):\\
\;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + 2 \cdot y\right)\\
\end{array}
\end{array}
if z < -5.59999999999999995e-49 or 3.00000000000000023e46 < z Initial program 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 80.1%
Taylor expanded in y around 0 76.1%
if -5.59999999999999995e-49 < z < 3.00000000000000023e46Initial program 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 64.5%
Taylor expanded in z around 0 61.5%
Final simplification68.8%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.4e+24) (not (<= y 0.0018))) (* 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 <= -1.4e+24) || !(y <= 0.0018)) {
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 <= (-1.4d+24)) .or. (.not. (y <= 0.0018d0))) 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 <= -1.4e+24) || !(y <= 0.0018)) {
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 <= -1.4e+24) or not (y <= 0.0018): 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 <= -1.4e+24) || !(y <= 0.0018)) 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 <= -1.4e+24) || ~((y <= 0.0018))) 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, -1.4e+24], N[Not[LessEqual[y, 0.0018]], $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 -1.4 \cdot 10^{+24} \lor \neg \left(y \leq 0.0018\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 < -1.4000000000000001e24 or 0.0018 < y Initial program 100.0%
Taylor expanded in y around inf 79.4%
if -1.4000000000000001e24 < y < 0.0018Initial program 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 82.2%
Taylor expanded in y around 0 78.8%
Final simplification79.1%
(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 100.0%
Final simplification100.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4.6e-90) (not (<= x 3.7e-31))) (* x t) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.6e-90) || !(x <= 3.7e-31)) {
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.6d-90)) .or. (.not. (x <= 3.7d-31))) 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.6e-90) || !(x <= 3.7e-31)) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -4.6e-90) or not (x <= 3.7e-31): tmp = x * t else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -4.6e-90) || !(x <= 3.7e-31)) 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.6e-90) || ~((x <= 3.7e-31))) tmp = x * t; else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4.6e-90], N[Not[LessEqual[x, 3.7e-31]], $MachinePrecision]], N[(x * t), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.6 \cdot 10^{-90} \lor \neg \left(x \leq 3.7 \cdot 10^{-31}\right):\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -4.5999999999999996e-90 or 3.6999999999999998e-31 < 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 95.2%
Taylor expanded in t around inf 38.2%
*-commutative38.2%
Simplified38.2%
if -4.5999999999999996e-90 < x < 3.6999999999999998e-31Initial program 100.0%
Taylor expanded in x around 0 60.4%
Simplified60.4%
Final simplification47.6%
(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 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 72.3%
Taylor expanded in t around inf 30.5%
*-commutative30.5%
Simplified30.5%
Final simplification30.5%
herbie shell --seed 2024031
(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)))