
(FPCore (x y z t a b) :precision binary64 (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x + (y * z)) + (t * a)) + ((a * z) * b);
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((x + (y * z)) + (t * a)) + ((a * z) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x + (y * z)) + (t * a)) + ((a * z) * b);
}
def code(x, y, z, t, a, b): return ((x + (y * z)) + (t * a)) + ((a * z) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x + Float64(y * z)) + Float64(t * a)) + Float64(Float64(a * z) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x + (y * z)) + (t * a)) + ((a * z) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision] + N[(N[(a * z), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x + (y * z)) + (t * a)) + ((a * z) * b);
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((x + (y * z)) + (t * a)) + ((a * z) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x + (y * z)) + (t * a)) + ((a * z) * b);
}
def code(x, y, z, t, a, b): return ((x + (y * z)) + (t * a)) + ((a * z) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x + Float64(y * z)) + Float64(t * a)) + Float64(Float64(a * z) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x + (y * z)) + (t * a)) + ((a * z) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision] + N[(N[(a * z), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b
\end{array}
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (+ (* (* z a) b) (+ (+ x (* y z)) (* t a))))) (if (<= t_1 INFINITY) t_1 (* z (+ y (* a b))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((z * a) * b) + ((x + (y * z)) + (t * a));
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = z * (y + (a * b));
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((z * a) * b) + ((x + (y * z)) + (t * a));
double tmp;
if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = z * (y + (a * b));
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = ((z * a) * b) + ((x + (y * z)) + (t * a)) tmp = 0 if t_1 <= math.inf: tmp = t_1 else: tmp = z * (y + (a * b)) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(z * a) * b) + Float64(Float64(x + Float64(y * z)) + Float64(t * a))) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(z * Float64(y + Float64(a * b))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = ((z * a) * b) + ((x + (y * z)) + (t * a)); tmp = 0.0; if (t_1 <= Inf) tmp = t_1; else tmp = z * (y + (a * b)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(z * a), $MachinePrecision] * b), $MachinePrecision] + N[(N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(z * N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(z \cdot a\right) \cdot b + \left(\left(x + y \cdot z\right) + t \cdot a\right)\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y + a \cdot b\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b)) < +inf.0Initial program 99.2%
if +inf.0 < (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b)) Initial program 0.0%
associate-+l+0.0%
associate-*l*28.6%
Simplified28.6%
Taylor expanded in z around inf 85.7%
+-commutative85.7%
Simplified85.7%
Final simplification98.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* a (* z b))))
(if (<= a -1.75e+263)
t_1
(if (<= a -6.6e+196)
(* t a)
(if (<= a -7.5e+112)
t_1
(if (<= a 2.4e+51)
(+ x (* y z))
(if (<= a 4.9e+172) t_1 (* t a))))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a * (z * b);
double tmp;
if (a <= -1.75e+263) {
tmp = t_1;
} else if (a <= -6.6e+196) {
tmp = t * a;
} else if (a <= -7.5e+112) {
tmp = t_1;
} else if (a <= 2.4e+51) {
tmp = x + (y * z);
} else if (a <= 4.9e+172) {
tmp = t_1;
} else {
tmp = t * a;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = a * (z * b)
if (a <= (-1.75d+263)) then
tmp = t_1
else if (a <= (-6.6d+196)) then
tmp = t * a
else if (a <= (-7.5d+112)) then
tmp = t_1
else if (a <= 2.4d+51) then
tmp = x + (y * z)
else if (a <= 4.9d+172) then
tmp = t_1
else
tmp = t * a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a * (z * b);
double tmp;
if (a <= -1.75e+263) {
tmp = t_1;
} else if (a <= -6.6e+196) {
tmp = t * a;
} else if (a <= -7.5e+112) {
tmp = t_1;
} else if (a <= 2.4e+51) {
tmp = x + (y * z);
} else if (a <= 4.9e+172) {
tmp = t_1;
} else {
tmp = t * a;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = a * (z * b) tmp = 0 if a <= -1.75e+263: tmp = t_1 elif a <= -6.6e+196: tmp = t * a elif a <= -7.5e+112: tmp = t_1 elif a <= 2.4e+51: tmp = x + (y * z) elif a <= 4.9e+172: tmp = t_1 else: tmp = t * a return tmp
function code(x, y, z, t, a, b) t_1 = Float64(a * Float64(z * b)) tmp = 0.0 if (a <= -1.75e+263) tmp = t_1; elseif (a <= -6.6e+196) tmp = Float64(t * a); elseif (a <= -7.5e+112) tmp = t_1; elseif (a <= 2.4e+51) tmp = Float64(x + Float64(y * z)); elseif (a <= 4.9e+172) tmp = t_1; else tmp = Float64(t * a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = a * (z * b); tmp = 0.0; if (a <= -1.75e+263) tmp = t_1; elseif (a <= -6.6e+196) tmp = t * a; elseif (a <= -7.5e+112) tmp = t_1; elseif (a <= 2.4e+51) tmp = x + (y * z); elseif (a <= 4.9e+172) tmp = t_1; else tmp = t * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a * N[(z * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -1.75e+263], t$95$1, If[LessEqual[a, -6.6e+196], N[(t * a), $MachinePrecision], If[LessEqual[a, -7.5e+112], t$95$1, If[LessEqual[a, 2.4e+51], N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 4.9e+172], t$95$1, N[(t * a), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot \left(z \cdot b\right)\\
\mathbf{if}\;a \leq -1.75 \cdot 10^{+263}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq -6.6 \cdot 10^{+196}:\\
\;\;\;\;t \cdot a\\
\mathbf{elif}\;a \leq -7.5 \cdot 10^{+112}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 2.4 \cdot 10^{+51}:\\
\;\;\;\;x + y \cdot z\\
\mathbf{elif}\;a \leq 4.9 \cdot 10^{+172}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t \cdot a\\
\end{array}
\end{array}
if a < -1.74999999999999999e263 or -6.6000000000000003e196 < a < -7.5e112 or 2.3999999999999999e51 < a < 4.9000000000000001e172Initial program 83.9%
associate-+l+83.9%
associate-*l*91.8%
Simplified91.8%
Taylor expanded in z around inf 66.5%
+-commutative66.5%
Simplified66.5%
Taylor expanded in a around inf 57.9%
*-commutative57.9%
Simplified57.9%
if -1.74999999999999999e263 < a < -6.6000000000000003e196 or 4.9000000000000001e172 < a Initial program 88.1%
associate-+l+88.1%
associate-*l*90.4%
Simplified90.4%
Taylor expanded in z around 0 71.3%
+-commutative71.3%
Simplified71.3%
Taylor expanded in a around inf 64.2%
if -7.5e112 < a < 2.3999999999999999e51Initial program 98.2%
associate-+l+98.2%
associate-*l*94.1%
Simplified94.1%
Taylor expanded in a around 0 72.8%
Final simplification68.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ x (* y z))))
(if (<= z -1.95e+14)
t_1
(if (<= z 7.2e+47)
(+ x (* t a))
(if (<= z 1.56e+239) t_1 (* a (* z b)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + (y * z);
double tmp;
if (z <= -1.95e+14) {
tmp = t_1;
} else if (z <= 7.2e+47) {
tmp = x + (t * a);
} else if (z <= 1.56e+239) {
tmp = t_1;
} else {
tmp = a * (z * b);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = x + (y * z)
if (z <= (-1.95d+14)) then
tmp = t_1
else if (z <= 7.2d+47) then
tmp = x + (t * a)
else if (z <= 1.56d+239) then
tmp = t_1
else
tmp = a * (z * b)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + (y * z);
double tmp;
if (z <= -1.95e+14) {
tmp = t_1;
} else if (z <= 7.2e+47) {
tmp = x + (t * a);
} else if (z <= 1.56e+239) {
tmp = t_1;
} else {
tmp = a * (z * b);
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x + (y * z) tmp = 0 if z <= -1.95e+14: tmp = t_1 elif z <= 7.2e+47: tmp = x + (t * a) elif z <= 1.56e+239: tmp = t_1 else: tmp = a * (z * b) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x + Float64(y * z)) tmp = 0.0 if (z <= -1.95e+14) tmp = t_1; elseif (z <= 7.2e+47) tmp = Float64(x + Float64(t * a)); elseif (z <= 1.56e+239) tmp = t_1; else tmp = Float64(a * Float64(z * b)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x + (y * z); tmp = 0.0; if (z <= -1.95e+14) tmp = t_1; elseif (z <= 7.2e+47) tmp = x + (t * a); elseif (z <= 1.56e+239) tmp = t_1; else tmp = a * (z * b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.95e+14], t$95$1, If[LessEqual[z, 7.2e+47], N[(x + N[(t * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.56e+239], t$95$1, N[(a * N[(z * b), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + y \cdot z\\
\mathbf{if}\;z \leq -1.95 \cdot 10^{+14}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{+47}:\\
\;\;\;\;x + t \cdot a\\
\mathbf{elif}\;z \leq 1.56 \cdot 10^{+239}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(z \cdot b\right)\\
\end{array}
\end{array}
if z < -1.95e14 or 7.20000000000000015e47 < z < 1.55999999999999997e239Initial program 90.1%
associate-+l+90.1%
associate-*l*87.5%
Simplified87.5%
Taylor expanded in a around 0 67.1%
if -1.95e14 < z < 7.20000000000000015e47Initial program 98.5%
associate-+l+98.5%
associate-*l*99.3%
Simplified99.3%
Taylor expanded in z around 0 78.8%
+-commutative78.8%
Simplified78.8%
if 1.55999999999999997e239 < z Initial program 70.1%
associate-+l+70.1%
associate-*l*69.2%
Simplified69.2%
Taylor expanded in z around inf 100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in a around inf 77.0%
*-commutative77.0%
Simplified77.0%
Final simplification74.1%
(FPCore (x y z t a b) :precision binary64 (if (<= z 2.8e+159) (+ (+ x (* y z)) (+ (* a (* z b)) (* t a))) (* z (+ y (* a b)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= 2.8e+159) {
tmp = (x + (y * z)) + ((a * (z * b)) + (t * a));
} else {
tmp = z * (y + (a * b));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (z <= 2.8d+159) then
tmp = (x + (y * z)) + ((a * (z * b)) + (t * a))
else
tmp = z * (y + (a * b))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= 2.8e+159) {
tmp = (x + (y * z)) + ((a * (z * b)) + (t * a));
} else {
tmp = z * (y + (a * b));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= 2.8e+159: tmp = (x + (y * z)) + ((a * (z * b)) + (t * a)) else: tmp = z * (y + (a * b)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= 2.8e+159) tmp = Float64(Float64(x + Float64(y * z)) + Float64(Float64(a * Float64(z * b)) + Float64(t * a))); else tmp = Float64(z * Float64(y + Float64(a * b))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= 2.8e+159) tmp = (x + (y * z)) + ((a * (z * b)) + (t * a)); else tmp = z * (y + (a * b)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, 2.8e+159], N[(N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(N[(a * N[(z * b), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2.8 \cdot 10^{+159}:\\
\;\;\;\;\left(x + y \cdot z\right) + \left(a \cdot \left(z \cdot b\right) + t \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y + a \cdot b\right)\\
\end{array}
\end{array}
if z < 2.8000000000000001e159Initial program 96.3%
associate-+l+96.3%
associate-*l*95.6%
Simplified95.6%
if 2.8000000000000001e159 < z Initial program 78.7%
associate-+l+78.7%
associate-*l*78.4%
Simplified78.4%
Taylor expanded in z around inf 94.8%
+-commutative94.8%
Simplified94.8%
Final simplification95.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -2.7e+14) (not (<= z 4.5e+55))) (* z (+ y (* a b))) (+ x (* a (+ t (* z b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -2.7e+14) || !(z <= 4.5e+55)) {
tmp = z * (y + (a * b));
} else {
tmp = x + (a * (t + (z * b)));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((z <= (-2.7d+14)) .or. (.not. (z <= 4.5d+55))) then
tmp = z * (y + (a * b))
else
tmp = x + (a * (t + (z * b)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -2.7e+14) || !(z <= 4.5e+55)) {
tmp = z * (y + (a * b));
} else {
tmp = x + (a * (t + (z * b)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -2.7e+14) or not (z <= 4.5e+55): tmp = z * (y + (a * b)) else: tmp = x + (a * (t + (z * b))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -2.7e+14) || !(z <= 4.5e+55)) tmp = Float64(z * Float64(y + Float64(a * b))); else tmp = Float64(x + Float64(a * Float64(t + Float64(z * b)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -2.7e+14) || ~((z <= 4.5e+55))) tmp = z * (y + (a * b)); else tmp = x + (a * (t + (z * b))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -2.7e+14], N[Not[LessEqual[z, 4.5e+55]], $MachinePrecision]], N[(z * N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(a * N[(t + N[(z * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.7 \cdot 10^{+14} \lor \neg \left(z \leq 4.5 \cdot 10^{+55}\right):\\
\;\;\;\;z \cdot \left(y + a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x + a \cdot \left(t + z \cdot b\right)\\
\end{array}
\end{array}
if z < -2.7e14 or 4.49999999999999998e55 < z Initial program 87.7%
associate-+l+87.7%
associate-*l*85.3%
Simplified85.3%
Taylor expanded in z around inf 84.5%
+-commutative84.5%
Simplified84.5%
if -2.7e14 < z < 4.49999999999999998e55Initial program 98.6%
associate-+l+98.6%
+-commutative98.6%
fma-define98.6%
associate-*l*99.3%
*-commutative99.3%
*-commutative99.3%
distribute-rgt-out100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in y around 0 91.2%
Final simplification88.2%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -1.85e-52) (not (<= y 2.6e-50))) (+ (+ x (* y z)) (* t a)) (+ x (* a (+ t (* z b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -1.85e-52) || !(y <= 2.6e-50)) {
tmp = (x + (y * z)) + (t * a);
} else {
tmp = x + (a * (t + (z * b)));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((y <= (-1.85d-52)) .or. (.not. (y <= 2.6d-50))) then
tmp = (x + (y * z)) + (t * a)
else
tmp = x + (a * (t + (z * b)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -1.85e-52) || !(y <= 2.6e-50)) {
tmp = (x + (y * z)) + (t * a);
} else {
tmp = x + (a * (t + (z * b)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -1.85e-52) or not (y <= 2.6e-50): tmp = (x + (y * z)) + (t * a) else: tmp = x + (a * (t + (z * b))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -1.85e-52) || !(y <= 2.6e-50)) tmp = Float64(Float64(x + Float64(y * z)) + Float64(t * a)); else tmp = Float64(x + Float64(a * Float64(t + Float64(z * b)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -1.85e-52) || ~((y <= 2.6e-50))) tmp = (x + (y * z)) + (t * a); else tmp = x + (a * (t + (z * b))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -1.85e-52], N[Not[LessEqual[y, 2.6e-50]], $MachinePrecision]], N[(N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision], N[(x + N[(a * N[(t + N[(z * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.85 \cdot 10^{-52} \lor \neg \left(y \leq 2.6 \cdot 10^{-50}\right):\\
\;\;\;\;\left(x + y \cdot z\right) + t \cdot a\\
\mathbf{else}:\\
\;\;\;\;x + a \cdot \left(t + z \cdot b\right)\\
\end{array}
\end{array}
if y < -1.8499999999999999e-52 or 2.6000000000000001e-50 < y Initial program 92.6%
associate-+l+92.6%
associate-*l*90.9%
Simplified90.9%
Taylor expanded in t around inf 88.2%
if -1.8499999999999999e-52 < y < 2.6000000000000001e-50Initial program 95.9%
associate-+l+95.9%
+-commutative95.9%
fma-define95.9%
associate-*l*96.9%
*-commutative96.9%
*-commutative96.9%
distribute-rgt-out99.0%
*-commutative99.0%
Simplified99.0%
Taylor expanded in y around 0 95.9%
Final simplification91.0%
(FPCore (x y z t a b) :precision binary64 (if (<= t -2.6e-40) (* t a) (if (<= t -1.7e-258) x (if (<= t 1350000.0) (* y z) (* t a)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -2.6e-40) {
tmp = t * a;
} else if (t <= -1.7e-258) {
tmp = x;
} else if (t <= 1350000.0) {
tmp = y * z;
} else {
tmp = t * a;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (t <= (-2.6d-40)) then
tmp = t * a
else if (t <= (-1.7d-258)) then
tmp = x
else if (t <= 1350000.0d0) then
tmp = y * z
else
tmp = t * a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -2.6e-40) {
tmp = t * a;
} else if (t <= -1.7e-258) {
tmp = x;
} else if (t <= 1350000.0) {
tmp = y * z;
} else {
tmp = t * a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -2.6e-40: tmp = t * a elif t <= -1.7e-258: tmp = x elif t <= 1350000.0: tmp = y * z else: tmp = t * a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -2.6e-40) tmp = Float64(t * a); elseif (t <= -1.7e-258) tmp = x; elseif (t <= 1350000.0) tmp = Float64(y * z); else tmp = Float64(t * a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -2.6e-40) tmp = t * a; elseif (t <= -1.7e-258) tmp = x; elseif (t <= 1350000.0) tmp = y * z; else tmp = t * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -2.6e-40], N[(t * a), $MachinePrecision], If[LessEqual[t, -1.7e-258], x, If[LessEqual[t, 1350000.0], N[(y * z), $MachinePrecision], N[(t * a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.6 \cdot 10^{-40}:\\
\;\;\;\;t \cdot a\\
\mathbf{elif}\;t \leq -1.7 \cdot 10^{-258}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 1350000:\\
\;\;\;\;y \cdot z\\
\mathbf{else}:\\
\;\;\;\;t \cdot a\\
\end{array}
\end{array}
if t < -2.6000000000000001e-40 or 1.35e6 < t Initial program 92.4%
associate-+l+92.4%
associate-*l*90.7%
Simplified90.7%
Taylor expanded in z around 0 71.7%
+-commutative71.7%
Simplified71.7%
Taylor expanded in a around inf 53.3%
if -2.6000000000000001e-40 < t < -1.6999999999999999e-258Initial program 97.8%
associate-+l+97.8%
associate-*l*95.6%
Simplified95.6%
Taylor expanded in x around inf 45.0%
if -1.6999999999999999e-258 < t < 1.35e6Initial program 93.6%
associate-+l+93.6%
associate-*l*94.8%
Simplified94.8%
Taylor expanded in y around inf 43.2%
*-commutative43.2%
Simplified43.2%
Final simplification48.1%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -195000000.0) (not (<= z 3.4e+50))) (* z (+ y (* a b))) (+ x (* t a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -195000000.0) || !(z <= 3.4e+50)) {
tmp = z * (y + (a * b));
} else {
tmp = x + (t * a);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((z <= (-195000000.0d0)) .or. (.not. (z <= 3.4d+50))) then
tmp = z * (y + (a * b))
else
tmp = x + (t * a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -195000000.0) || !(z <= 3.4e+50)) {
tmp = z * (y + (a * b));
} else {
tmp = x + (t * a);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -195000000.0) or not (z <= 3.4e+50): tmp = z * (y + (a * b)) else: tmp = x + (t * a) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -195000000.0) || !(z <= 3.4e+50)) tmp = Float64(z * Float64(y + Float64(a * b))); else tmp = Float64(x + Float64(t * a)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -195000000.0) || ~((z <= 3.4e+50))) tmp = z * (y + (a * b)); else tmp = x + (t * a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -195000000.0], N[Not[LessEqual[z, 3.4e+50]], $MachinePrecision]], N[(z * N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -195000000 \lor \neg \left(z \leq 3.4 \cdot 10^{+50}\right):\\
\;\;\;\;z \cdot \left(y + a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot a\\
\end{array}
\end{array}
if z < -1.95e8 or 3.3999999999999998e50 < z Initial program 87.8%
associate-+l+87.8%
associate-*l*85.4%
Simplified85.4%
Taylor expanded in z around inf 84.6%
+-commutative84.6%
Simplified84.6%
if -1.95e8 < z < 3.3999999999999998e50Initial program 98.5%
associate-+l+98.5%
associate-*l*99.3%
Simplified99.3%
Taylor expanded in z around 0 79.5%
+-commutative79.5%
Simplified79.5%
Final simplification81.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -9e-40) (not (<= t 1600000.0))) (* t a) x))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -9e-40) || !(t <= 1600000.0)) {
tmp = t * a;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((t <= (-9d-40)) .or. (.not. (t <= 1600000.0d0))) then
tmp = t * a
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -9e-40) || !(t <= 1600000.0)) {
tmp = t * a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (t <= -9e-40) or not (t <= 1600000.0): tmp = t * a else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -9e-40) || !(t <= 1600000.0)) tmp = Float64(t * a); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((t <= -9e-40) || ~((t <= 1600000.0))) tmp = t * a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -9e-40], N[Not[LessEqual[t, 1600000.0]], $MachinePrecision]], N[(t * a), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9 \cdot 10^{-40} \lor \neg \left(t \leq 1600000\right):\\
\;\;\;\;t \cdot a\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -9.0000000000000002e-40 or 1.6e6 < t Initial program 92.4%
associate-+l+92.4%
associate-*l*90.7%
Simplified90.7%
Taylor expanded in z around 0 71.7%
+-commutative71.7%
Simplified71.7%
Taylor expanded in a around inf 53.3%
if -9.0000000000000002e-40 < t < 1.6e6Initial program 94.9%
associate-+l+94.9%
associate-*l*95.1%
Simplified95.1%
Taylor expanded in x around inf 33.9%
Final simplification42.8%
(FPCore (x y z t a b) :precision binary64 x)
double code(double x, double y, double z, double t, double a, double b) {
return x;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = x
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x;
}
def code(x, y, z, t, a, b): return x
function code(x, y, z, t, a, b) return x end
function tmp = code(x, y, z, t, a, b) tmp = x; end
code[x_, y_, z_, t_, a_, b_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 93.8%
associate-+l+93.8%
associate-*l*93.1%
Simplified93.1%
Taylor expanded in x around inf 27.9%
Final simplification27.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (* z (+ (* b a) y)) (+ x (* t a)))))
(if (< z -11820553527347888000.0)
t_1
(if (< z 4.7589743188364287e-122)
(+ (* (+ (* b z) t) a) (+ (* z y) x))
t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (z * ((b * a) + y)) + (x + (t * a));
double tmp;
if (z < -11820553527347888000.0) {
tmp = t_1;
} else if (z < 4.7589743188364287e-122) {
tmp = (((b * z) + t) * a) + ((z * y) + x);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = (z * ((b * a) + y)) + (x + (t * a))
if (z < (-11820553527347888000.0d0)) then
tmp = t_1
else if (z < 4.7589743188364287d-122) then
tmp = (((b * z) + t) * a) + ((z * y) + x)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (z * ((b * a) + y)) + (x + (t * a));
double tmp;
if (z < -11820553527347888000.0) {
tmp = t_1;
} else if (z < 4.7589743188364287e-122) {
tmp = (((b * z) + t) * a) + ((z * y) + x);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (z * ((b * a) + y)) + (x + (t * a)) tmp = 0 if z < -11820553527347888000.0: tmp = t_1 elif z < 4.7589743188364287e-122: tmp = (((b * z) + t) * a) + ((z * y) + x) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(z * Float64(Float64(b * a) + y)) + Float64(x + Float64(t * a))) tmp = 0.0 if (z < -11820553527347888000.0) tmp = t_1; elseif (z < 4.7589743188364287e-122) tmp = Float64(Float64(Float64(Float64(b * z) + t) * a) + Float64(Float64(z * y) + x)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (z * ((b * a) + y)) + (x + (t * a)); tmp = 0.0; if (z < -11820553527347888000.0) tmp = t_1; elseif (z < 4.7589743188364287e-122) tmp = (((b * z) + t) * a) + ((z * y) + x); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(z * N[(N[(b * a), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision] + N[(x + N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[z, -11820553527347888000.0], t$95$1, If[Less[z, 4.7589743188364287e-122], N[(N[(N[(N[(b * z), $MachinePrecision] + t), $MachinePrecision] * a), $MachinePrecision] + N[(N[(z * y), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(b \cdot a + y\right) + \left(x + t \cdot a\right)\\
\mathbf{if}\;z < -11820553527347888000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z < 4.7589743188364287 \cdot 10^{-122}:\\
\;\;\;\;\left(b \cdot z + t\right) \cdot a + \left(z \cdot y + x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024055
(FPCore (x y z t a b)
:name "Graphics.Rasterific.CubicBezier:cachedBezierAt from Rasterific-0.6.1"
:precision binary64
:alt
(if (< z -11820553527347888000.0) (+ (* z (+ (* b a) y)) (+ x (* t a))) (if (< z 4.7589743188364287e-122) (+ (* (+ (* b z) t) a) (+ (* z y) x)) (+ (* z (+ (* b a) y)) (+ x (* t a)))))
(+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))