
(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 (* x (+ t (* 2.0 z)))) (t_2 (* x (* 2.0 (+ y z)))))
(if (<= x -3e+188)
t_2
(if (<= x -5.5e-68)
t_1
(if (<= x 5e-126)
(* y 5.0)
(if (<= x 8e-81)
t_1
(if (<= x 2.85e-30)
(* y 5.0)
(if (or (<= x 2.3e+52)
(and (not (<= x 1.96e+167)) (<= x 2.7e+206)))
t_1
t_2))))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t + (2.0 * z));
double t_2 = x * (2.0 * (y + z));
double tmp;
if (x <= -3e+188) {
tmp = t_2;
} else if (x <= -5.5e-68) {
tmp = t_1;
} else if (x <= 5e-126) {
tmp = y * 5.0;
} else if (x <= 8e-81) {
tmp = t_1;
} else if (x <= 2.85e-30) {
tmp = y * 5.0;
} else if ((x <= 2.3e+52) || (!(x <= 1.96e+167) && (x <= 2.7e+206))) {
tmp = t_1;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = x * (t + (2.0d0 * z))
t_2 = x * (2.0d0 * (y + z))
if (x <= (-3d+188)) then
tmp = t_2
else if (x <= (-5.5d-68)) then
tmp = t_1
else if (x <= 5d-126) then
tmp = y * 5.0d0
else if (x <= 8d-81) then
tmp = t_1
else if (x <= 2.85d-30) then
tmp = y * 5.0d0
else if ((x <= 2.3d+52) .or. (.not. (x <= 1.96d+167)) .and. (x <= 2.7d+206)) then
tmp = t_1
else
tmp = t_2
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 * z));
double t_2 = x * (2.0 * (y + z));
double tmp;
if (x <= -3e+188) {
tmp = t_2;
} else if (x <= -5.5e-68) {
tmp = t_1;
} else if (x <= 5e-126) {
tmp = y * 5.0;
} else if (x <= 8e-81) {
tmp = t_1;
} else if (x <= 2.85e-30) {
tmp = y * 5.0;
} else if ((x <= 2.3e+52) || (!(x <= 1.96e+167) && (x <= 2.7e+206))) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t + (2.0 * z)) t_2 = x * (2.0 * (y + z)) tmp = 0 if x <= -3e+188: tmp = t_2 elif x <= -5.5e-68: tmp = t_1 elif x <= 5e-126: tmp = y * 5.0 elif x <= 8e-81: tmp = t_1 elif x <= 2.85e-30: tmp = y * 5.0 elif (x <= 2.3e+52) or (not (x <= 1.96e+167) and (x <= 2.7e+206)): tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t + Float64(2.0 * z))) t_2 = Float64(x * Float64(2.0 * Float64(y + z))) tmp = 0.0 if (x <= -3e+188) tmp = t_2; elseif (x <= -5.5e-68) tmp = t_1; elseif (x <= 5e-126) tmp = Float64(y * 5.0); elseif (x <= 8e-81) tmp = t_1; elseif (x <= 2.85e-30) tmp = Float64(y * 5.0); elseif ((x <= 2.3e+52) || (!(x <= 1.96e+167) && (x <= 2.7e+206))) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t + (2.0 * z)); t_2 = x * (2.0 * (y + z)); tmp = 0.0; if (x <= -3e+188) tmp = t_2; elseif (x <= -5.5e-68) tmp = t_1; elseif (x <= 5e-126) tmp = y * 5.0; elseif (x <= 8e-81) tmp = t_1; elseif (x <= 2.85e-30) tmp = y * 5.0; elseif ((x <= 2.3e+52) || (~((x <= 1.96e+167)) && (x <= 2.7e+206))) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3e+188], t$95$2, If[LessEqual[x, -5.5e-68], t$95$1, If[LessEqual[x, 5e-126], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 8e-81], t$95$1, If[LessEqual[x, 2.85e-30], N[(y * 5.0), $MachinePrecision], If[Or[LessEqual[x, 2.3e+52], And[N[Not[LessEqual[x, 1.96e+167]], $MachinePrecision], LessEqual[x, 2.7e+206]]], t$95$1, t$95$2]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(t + 2 \cdot z\right)\\
t_2 := x \cdot \left(2 \cdot \left(y + z\right)\right)\\
\mathbf{if}\;x \leq -3 \cdot 10^{+188}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -5.5 \cdot 10^{-68}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 5 \cdot 10^{-126}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 8 \cdot 10^{-81}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 2.85 \cdot 10^{-30}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{+52} \lor \neg \left(x \leq 1.96 \cdot 10^{+167}\right) \land x \leq 2.7 \cdot 10^{+206}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if x < -3.0000000000000001e188 or 2.3e52 < x < 1.95999999999999988e167 or 2.70000000000000003e206 < x Initial program 100.0%
Taylor expanded in t around 0 88.7%
Simplified88.7%
Taylor expanded in x around inf 88.7%
associate-*r*88.7%
*-commutative88.7%
+-commutative88.7%
associate-*r*88.7%
+-commutative88.7%
Simplified88.7%
if -3.0000000000000001e188 < x < -5.5000000000000003e-68 or 5.00000000000000006e-126 < x < 7.9999999999999997e-81 or 2.84999999999999989e-30 < x < 2.3e52 or 1.95999999999999988e167 < x < 2.70000000000000003e206Initial program 99.9%
Taylor expanded in y around 0 76.6%
Simplified76.6%
if -5.5000000000000003e-68 < x < 5.00000000000000006e-126 or 7.9999999999999997e-81 < x < 2.84999999999999989e-30Initial program 99.9%
Taylor expanded in x around 0 72.2%
Simplified72.2%
Final simplification78.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (* 2.0 (+ y z)))))
(if (<= x -2.55e+123)
t_1
(if (<= x -9e+91)
(* x t)
(if (<= x -1e-63)
t_1
(if (<= x 5e-126)
(* y 5.0)
(if (<= x 1.1e-91)
(* x t)
(if (<= x 2.5e-30)
(* y 5.0)
(if (<= x 6.8e+45) (* x t) t_1)))))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (2.0 * (y + z));
double tmp;
if (x <= -2.55e+123) {
tmp = t_1;
} else if (x <= -9e+91) {
tmp = x * t;
} else if (x <= -1e-63) {
tmp = t_1;
} else if (x <= 5e-126) {
tmp = y * 5.0;
} else if (x <= 1.1e-91) {
tmp = x * t;
} else if (x <= 2.5e-30) {
tmp = y * 5.0;
} else if (x <= 6.8e+45) {
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 + z))
if (x <= (-2.55d+123)) then
tmp = t_1
else if (x <= (-9d+91)) then
tmp = x * t
else if (x <= (-1d-63)) then
tmp = t_1
else if (x <= 5d-126) then
tmp = y * 5.0d0
else if (x <= 1.1d-91) then
tmp = x * t
else if (x <= 2.5d-30) then
tmp = y * 5.0d0
else if (x <= 6.8d+45) 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 + z));
double tmp;
if (x <= -2.55e+123) {
tmp = t_1;
} else if (x <= -9e+91) {
tmp = x * t;
} else if (x <= -1e-63) {
tmp = t_1;
} else if (x <= 5e-126) {
tmp = y * 5.0;
} else if (x <= 1.1e-91) {
tmp = x * t;
} else if (x <= 2.5e-30) {
tmp = y * 5.0;
} else if (x <= 6.8e+45) {
tmp = x * t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (2.0 * (y + z)) tmp = 0 if x <= -2.55e+123: tmp = t_1 elif x <= -9e+91: tmp = x * t elif x <= -1e-63: tmp = t_1 elif x <= 5e-126: tmp = y * 5.0 elif x <= 1.1e-91: tmp = x * t elif x <= 2.5e-30: tmp = y * 5.0 elif x <= 6.8e+45: tmp = x * t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(2.0 * Float64(y + z))) tmp = 0.0 if (x <= -2.55e+123) tmp = t_1; elseif (x <= -9e+91) tmp = Float64(x * t); elseif (x <= -1e-63) tmp = t_1; elseif (x <= 5e-126) tmp = Float64(y * 5.0); elseif (x <= 1.1e-91) tmp = Float64(x * t); elseif (x <= 2.5e-30) tmp = Float64(y * 5.0); elseif (x <= 6.8e+45) 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 + z)); tmp = 0.0; if (x <= -2.55e+123) tmp = t_1; elseif (x <= -9e+91) tmp = x * t; elseif (x <= -1e-63) tmp = t_1; elseif (x <= 5e-126) tmp = y * 5.0; elseif (x <= 1.1e-91) tmp = x * t; elseif (x <= 2.5e-30) tmp = y * 5.0; elseif (x <= 6.8e+45) 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 * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.55e+123], t$95$1, If[LessEqual[x, -9e+91], N[(x * t), $MachinePrecision], If[LessEqual[x, -1e-63], t$95$1, If[LessEqual[x, 5e-126], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 1.1e-91], N[(x * t), $MachinePrecision], If[LessEqual[x, 2.5e-30], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 6.8e+45], N[(x * t), $MachinePrecision], t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(2 \cdot \left(y + z\right)\right)\\
\mathbf{if}\;x \leq -2.55 \cdot 10^{+123}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -9 \cdot 10^{+91}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq -1 \cdot 10^{-63}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 5 \cdot 10^{-126}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{-91}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{-30}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 6.8 \cdot 10^{+45}:\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -2.54999999999999986e123 or -9e91 < x < -1.00000000000000007e-63 or 6.8e45 < x Initial program 100.0%
Taylor expanded in t around 0 81.6%
Simplified81.6%
Taylor expanded in x around inf 78.0%
associate-*r*78.0%
*-commutative78.0%
+-commutative78.0%
associate-*r*78.0%
+-commutative78.0%
Simplified78.0%
if -2.54999999999999986e123 < x < -9e91 or 5.00000000000000006e-126 < x < 1.1e-91 or 2.49999999999999986e-30 < x < 6.8e45Initial program 99.9%
Taylor expanded in t around inf 70.7%
Simplified70.7%
if -1.00000000000000007e-63 < x < 5.00000000000000006e-126 or 1.1e-91 < x < 2.49999999999999986e-30Initial program 99.9%
Taylor expanded in x around 0 72.2%
Simplified72.2%
Final simplification74.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 2.0 (* x z))))
(if (<= x -4e+193)
t_1
(if (<= x -1.4e+39)
(* x t)
(if (<= x -3e-55)
t_1
(if (<= x 4.6e-126)
(* y 5.0)
(if (<= x 9.5e-84)
(* x t)
(if (<= x 1.2e-32)
(* y 5.0)
(if (<= x 1.4e+103) (* 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 <= -4e+193) {
tmp = t_1;
} else if (x <= -1.4e+39) {
tmp = x * t;
} else if (x <= -3e-55) {
tmp = t_1;
} else if (x <= 4.6e-126) {
tmp = y * 5.0;
} else if (x <= 9.5e-84) {
tmp = x * t;
} else if (x <= 1.2e-32) {
tmp = y * 5.0;
} else if (x <= 1.4e+103) {
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 <= (-4d+193)) then
tmp = t_1
else if (x <= (-1.4d+39)) then
tmp = x * t
else if (x <= (-3d-55)) then
tmp = t_1
else if (x <= 4.6d-126) then
tmp = y * 5.0d0
else if (x <= 9.5d-84) then
tmp = x * t
else if (x <= 1.2d-32) then
tmp = y * 5.0d0
else if (x <= 1.4d+103) 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 <= -4e+193) {
tmp = t_1;
} else if (x <= -1.4e+39) {
tmp = x * t;
} else if (x <= -3e-55) {
tmp = t_1;
} else if (x <= 4.6e-126) {
tmp = y * 5.0;
} else if (x <= 9.5e-84) {
tmp = x * t;
} else if (x <= 1.2e-32) {
tmp = y * 5.0;
} else if (x <= 1.4e+103) {
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 <= -4e+193: tmp = t_1 elif x <= -1.4e+39: tmp = x * t elif x <= -3e-55: tmp = t_1 elif x <= 4.6e-126: tmp = y * 5.0 elif x <= 9.5e-84: tmp = x * t elif x <= 1.2e-32: tmp = y * 5.0 elif x <= 1.4e+103: 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 <= -4e+193) tmp = t_1; elseif (x <= -1.4e+39) tmp = Float64(x * t); elseif (x <= -3e-55) tmp = t_1; elseif (x <= 4.6e-126) tmp = Float64(y * 5.0); elseif (x <= 9.5e-84) tmp = Float64(x * t); elseif (x <= 1.2e-32) tmp = Float64(y * 5.0); elseif (x <= 1.4e+103) 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 <= -4e+193) tmp = t_1; elseif (x <= -1.4e+39) tmp = x * t; elseif (x <= -3e-55) tmp = t_1; elseif (x <= 4.6e-126) tmp = y * 5.0; elseif (x <= 9.5e-84) tmp = x * t; elseif (x <= 1.2e-32) tmp = y * 5.0; elseif (x <= 1.4e+103) 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, -4e+193], t$95$1, If[LessEqual[x, -1.4e+39], N[(x * t), $MachinePrecision], If[LessEqual[x, -3e-55], t$95$1, If[LessEqual[x, 4.6e-126], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 9.5e-84], N[(x * t), $MachinePrecision], If[LessEqual[x, 1.2e-32], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 1.4e+103], 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 -4 \cdot 10^{+193}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -1.4 \cdot 10^{+39}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq -3 \cdot 10^{-55}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 4.6 \cdot 10^{-126}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{-84}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{-32}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 1.4 \cdot 10^{+103}:\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -4.00000000000000026e193 or -1.40000000000000001e39 < x < -3.00000000000000016e-55 or 1.40000000000000004e103 < x Initial program 100.0%
Taylor expanded in z around inf 51.0%
Simplified51.0%
if -4.00000000000000026e193 < x < -1.40000000000000001e39 or 4.60000000000000021e-126 < x < 9.49999999999999941e-84 or 1.2000000000000001e-32 < x < 1.40000000000000004e103Initial program 99.9%
Taylor expanded in t around inf 50.6%
Simplified50.6%
if -3.00000000000000016e-55 < x < 4.60000000000000021e-126 or 9.49999999999999941e-84 < x < 1.2000000000000001e-32Initial program 99.9%
Taylor expanded in x around 0 72.2%
Simplified72.2%
Final simplification58.8%
(FPCore (x y z t) :precision binary64 (if (<= x 26500000.0) (+ (* 2.0 (* x (+ y z))) (+ (* y 5.0) (* x t))) (* x (+ (* 2.0 (+ y z)) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 26500000.0) {
tmp = (2.0 * (x * (y + z))) + ((y * 5.0) + (x * t));
} else {
tmp = x * ((2.0 * (y + z)) + 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 <= 26500000.0d0) then
tmp = (2.0d0 * (x * (y + z))) + ((y * 5.0d0) + (x * t))
else
tmp = x * ((2.0d0 * (y + z)) + t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 26500000.0) {
tmp = (2.0 * (x * (y + z))) + ((y * 5.0) + (x * t));
} else {
tmp = x * ((2.0 * (y + z)) + t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= 26500000.0: tmp = (2.0 * (x * (y + z))) + ((y * 5.0) + (x * t)) else: tmp = x * ((2.0 * (y + z)) + t) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= 26500000.0) tmp = Float64(Float64(2.0 * Float64(x * Float64(y + z))) + Float64(Float64(y * 5.0) + Float64(x * t))); else tmp = Float64(x * Float64(Float64(2.0 * Float64(y + z)) + t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= 26500000.0) tmp = (2.0 * (x * (y + z))) + ((y * 5.0) + (x * t)); else tmp = x * ((2.0 * (y + z)) + t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, 26500000.0], N[(N[(2.0 * N[(x * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 26500000:\\
\;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right) + \left(y \cdot 5 + x \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + z\right) + t\right)\\
\end{array}
\end{array}
if x < 2.65e7Initial program 99.9%
fma-def99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in t around 0 97.8%
if 2.65e7 < 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 100.0%
Final simplification98.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 2.0 (+ y z))) (t_2 (* x (+ t_1 t))))
(if (<= x -11000000000.0)
t_2
(if (<= x 2.4e-195)
(+ (* y 5.0) (* x t_1))
(if (<= x 9.5e-24) (+ (* y 5.0) (* x t)) t_2)))))
double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (y + z);
double t_2 = x * (t_1 + t);
double tmp;
if (x <= -11000000000.0) {
tmp = t_2;
} else if (x <= 2.4e-195) {
tmp = (y * 5.0) + (x * t_1);
} else if (x <= 9.5e-24) {
tmp = (y * 5.0) + (x * t);
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = 2.0d0 * (y + z)
t_2 = x * (t_1 + t)
if (x <= (-11000000000.0d0)) then
tmp = t_2
else if (x <= 2.4d-195) then
tmp = (y * 5.0d0) + (x * t_1)
else if (x <= 9.5d-24) then
tmp = (y * 5.0d0) + (x * t)
else
tmp = t_2
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 t_2 = x * (t_1 + t);
double tmp;
if (x <= -11000000000.0) {
tmp = t_2;
} else if (x <= 2.4e-195) {
tmp = (y * 5.0) + (x * t_1);
} else if (x <= 9.5e-24) {
tmp = (y * 5.0) + (x * t);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = 2.0 * (y + z) t_2 = x * (t_1 + t) tmp = 0 if x <= -11000000000.0: tmp = t_2 elif x <= 2.4e-195: tmp = (y * 5.0) + (x * t_1) elif x <= 9.5e-24: tmp = (y * 5.0) + (x * t) else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(2.0 * Float64(y + z)) t_2 = Float64(x * Float64(t_1 + t)) tmp = 0.0 if (x <= -11000000000.0) tmp = t_2; elseif (x <= 2.4e-195) tmp = Float64(Float64(y * 5.0) + Float64(x * t_1)); elseif (x <= 9.5e-24) tmp = Float64(Float64(y * 5.0) + Float64(x * t)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 2.0 * (y + z); t_2 = x * (t_1 + t); tmp = 0.0; if (x <= -11000000000.0) tmp = t_2; elseif (x <= 2.4e-195) tmp = (y * 5.0) + (x * t_1); elseif (x <= 9.5e-24) tmp = (y * 5.0) + (x * t); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(t$95$1 + t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -11000000000.0], t$95$2, If[LessEqual[x, 2.4e-195], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 9.5e-24], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(y + z\right)\\
t_2 := x \cdot \left(t_1 + t\right)\\
\mathbf{if}\;x \leq -11000000000:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{-195}:\\
\;\;\;\;y \cdot 5 + x \cdot t_1\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{-24}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if x < -1.1e10 or 9.50000000000000029e-24 < 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 99.6%
if -1.1e10 < x < 2.4e-195Initial program 99.9%
Taylor expanded in t around 0 88.7%
Simplified88.7%
if 2.4e-195 < x < 9.50000000000000029e-24Initial program 99.9%
associate-+l+99.9%
+-commutative99.9%
flip-+0.0%
pow20.0%
pow20.0%
Applied egg-rr0.0%
Simplified87.6%
Taylor expanded in x around 0 87.6%
Final simplification94.7%
(FPCore (x y z t) :precision binary64 (+ (* y 5.0) (* x (+ t (+ y (+ y (* 2.0 z)))))))
double code(double x, double y, double z, double t) {
return (y * 5.0) + (x * (t + (y + (y + (2.0 * 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 + (y + (2.0d0 * z)))))
end function
public static double code(double x, double y, double z, double t) {
return (y * 5.0) + (x * (t + (y + (y + (2.0 * z)))));
}
def code(x, y, z, t): return (y * 5.0) + (x * (t + (y + (y + (2.0 * z)))))
function code(x, y, z, t) return Float64(Float64(y * 5.0) + Float64(x * Float64(t + Float64(y + Float64(y + Float64(2.0 * z)))))) end
function tmp = code(x, y, z, t) tmp = (y * 5.0) + (x * (t + (y + (y + (2.0 * z))))); end
code[x_, y_, z_, t_] := N[(N[(y * 5.0), $MachinePrecision] + N[(x * N[(t + N[(y + N[(y + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot 5 + x \cdot \left(t + \left(y + \left(y + 2 \cdot z\right)\right)\right)
\end{array}
Initial program 99.9%
Taylor expanded in y around 0 99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -7.5e-20) (not (<= x 2.05e-32))) (* 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 <= -7.5e-20) || !(x <= 2.05e-32)) {
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 <= (-7.5d-20)) .or. (.not. (x <= 2.05d-32))) 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 <= -7.5e-20) || !(x <= 2.05e-32)) {
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 <= -7.5e-20) or not (x <= 2.05e-32): 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 <= -7.5e-20) || !(x <= 2.05e-32)) 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 <= -7.5e-20) || ~((x <= 2.05e-32))) 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, -7.5e-20], N[Not[LessEqual[x, 2.05e-32]], $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 -7.5 \cdot 10^{-20} \lor \neg \left(x \leq 2.05 \cdot 10^{-32}\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 < -7.49999999999999981e-20 or 2.04999999999999988e-32 < 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.8%
if -7.49999999999999981e-20 < x < 2.04999999999999988e-32Initial program 99.9%
associate-+l+99.9%
+-commutative99.9%
flip-+0.0%
pow20.0%
pow20.0%
Applied egg-rr0.0%
Simplified82.0%
Taylor expanded in x around 0 82.0%
Final simplification91.1%
(FPCore (x y z t)
:precision binary64
(if (or (<= x -11000000000.0)
(and (not (<= x 4.6e-126)) (or (<= x 1.1e-90) (not (<= x 3.7e-23)))))
(* x t)
(* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -11000000000.0) || (!(x <= 4.6e-126) && ((x <= 1.1e-90) || !(x <= 3.7e-23)))) {
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 <= (-11000000000.0d0)) .or. (.not. (x <= 4.6d-126)) .and. (x <= 1.1d-90) .or. (.not. (x <= 3.7d-23))) 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 <= -11000000000.0) || (!(x <= 4.6e-126) && ((x <= 1.1e-90) || !(x <= 3.7e-23)))) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -11000000000.0) or (not (x <= 4.6e-126) and ((x <= 1.1e-90) or not (x <= 3.7e-23))): tmp = x * t else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -11000000000.0) || (!(x <= 4.6e-126) && ((x <= 1.1e-90) || !(x <= 3.7e-23)))) 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 <= -11000000000.0) || (~((x <= 4.6e-126)) && ((x <= 1.1e-90) || ~((x <= 3.7e-23))))) tmp = x * t; else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -11000000000.0], And[N[Not[LessEqual[x, 4.6e-126]], $MachinePrecision], Or[LessEqual[x, 1.1e-90], N[Not[LessEqual[x, 3.7e-23]], $MachinePrecision]]]], N[(x * t), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -11000000000 \lor \neg \left(x \leq 4.6 \cdot 10^{-126}\right) \land \left(x \leq 1.1 \cdot 10^{-90} \lor \neg \left(x \leq 3.7 \cdot 10^{-23}\right)\right):\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -1.1e10 or 4.60000000000000021e-126 < x < 1.09999999999999993e-90 or 3.7000000000000003e-23 < x Initial program 100.0%
Taylor expanded in t around inf 38.0%
Simplified38.0%
if -1.1e10 < x < 4.60000000000000021e-126 or 1.09999999999999993e-90 < x < 3.7000000000000003e-23Initial program 99.9%
Taylor expanded in x around 0 68.3%
Simplified68.3%
Final simplification50.5%
(FPCore (x y z t) :precision binary64 (if (or (<= y -9e+109) (not (<= y 4.2e+56))) (* 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 <= -9e+109) || !(y <= 4.2e+56)) {
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 <= (-9d+109)) .or. (.not. (y <= 4.2d+56))) 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 <= -9e+109) || !(y <= 4.2e+56)) {
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 <= -9e+109) or not (y <= 4.2e+56): 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 <= -9e+109) || !(y <= 4.2e+56)) 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 <= -9e+109) || ~((y <= 4.2e+56))) 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, -9e+109], N[Not[LessEqual[y, 4.2e+56]], $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 -9 \cdot 10^{+109} \lor \neg \left(y \leq 4.2 \cdot 10^{+56}\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.9999999999999992e109 or 4.20000000000000034e56 < y Initial program 99.9%
Taylor expanded in y around inf 86.2%
if -8.9999999999999992e109 < y < 4.20000000000000034e56Initial program 100.0%
Taylor expanded in y around 0 76.2%
Simplified76.2%
Final simplification80.1%
(FPCore (x y z t) :precision binary64 (* x t))
double code(double x, double y, double z, double t) {
return x * t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x * t
end function
public static double code(double x, double y, double z, double t) {
return x * t;
}
def code(x, y, z, t): return x * t
function code(x, y, z, t) return Float64(x * t) end
function tmp = code(x, y, z, t) tmp = x * t; end
code[x_, y_, z_, t_] := N[(x * t), $MachinePrecision]
\begin{array}{l}
\\
x \cdot t
\end{array}
Initial program 99.9%
Taylor expanded in t around inf 27.9%
Simplified27.9%
Final simplification27.9%
herbie shell --seed 2024011
(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)))