
(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 13 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
(if (<= z -9.8e+207)
(+ x (+ (* z (fma a b y)) (* a t)))
(if (<= z 8.6e+127)
(+ (* a (+ t (* z b))) (+ x (* z y)))
(+ x (* z (+ y (* a b)))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -9.8e+207) {
tmp = x + ((z * fma(a, b, y)) + (a * t));
} else if (z <= 8.6e+127) {
tmp = (a * (t + (z * b))) + (x + (z * y));
} else {
tmp = x + (z * (y + (a * b)));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -9.8e+207) tmp = Float64(x + Float64(Float64(z * fma(a, b, y)) + Float64(a * t))); elseif (z <= 8.6e+127) tmp = Float64(Float64(a * Float64(t + Float64(z * b))) + Float64(x + Float64(z * y))); else tmp = Float64(x + Float64(z * Float64(y + Float64(a * b)))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -9.8e+207], N[(x + N[(N[(z * N[(a * b + y), $MachinePrecision]), $MachinePrecision] + N[(a * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.6e+127], N[(N[(a * N[(t + N[(z * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x + N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.8 \cdot 10^{+207}:\\
\;\;\;\;x + \left(z \cdot \mathsf{fma}\left(a, b, y\right) + a \cdot t\right)\\
\mathbf{elif}\;z \leq 8.6 \cdot 10^{+127}:\\
\;\;\;\;a \cdot \left(t + z \cdot b\right) + \left(x + z \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(y + a \cdot b\right)\\
\end{array}
\end{array}
if z < -9.8000000000000001e207Initial program 88.0%
+-commutative88.0%
+-commutative88.0%
associate-+l+88.0%
associate-+r+88.0%
*-commutative88.0%
associate-*l*92.0%
*-commutative92.0%
distribute-lft-out99.9%
fma-def99.9%
fma-def99.9%
+-commutative99.9%
fma-def99.9%
Simplified99.9%
fma-udef99.9%
fma-udef99.9%
associate-+r+99.9%
*-commutative99.9%
Applied egg-rr99.9%
if -9.8000000000000001e207 < z < 8.59999999999999968e127Initial program 94.4%
associate-+l+94.4%
associate-*l*96.0%
Simplified96.0%
Taylor expanded in a around 0 99.0%
if 8.59999999999999968e127 < z Initial program 86.7%
+-commutative86.7%
+-commutative86.7%
associate-+l+86.7%
associate-+r+86.7%
*-commutative86.7%
associate-*l*90.0%
*-commutative90.0%
distribute-lft-out93.3%
fma-def96.7%
fma-def96.7%
+-commutative96.7%
fma-def96.7%
Simplified96.7%
Taylor expanded in t around 0 96.7%
Final simplification98.8%
(FPCore (x y z t a b) :precision binary64 (if (<= a -1.3e+109) (fma a (+ t (* z b)) (fma y z x)) (+ x (+ (* z (fma a b y)) (* a t)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -1.3e+109) {
tmp = fma(a, (t + (z * b)), fma(y, z, x));
} else {
tmp = x + ((z * fma(a, b, y)) + (a * t));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -1.3e+109) tmp = fma(a, Float64(t + Float64(z * b)), fma(y, z, x)); else tmp = Float64(x + Float64(Float64(z * fma(a, b, y)) + Float64(a * t))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -1.3e+109], N[(a * N[(t + N[(z * b), $MachinePrecision]), $MachinePrecision] + N[(y * z + x), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z * N[(a * b + y), $MachinePrecision]), $MachinePrecision] + N[(a * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.3 \cdot 10^{+109}:\\
\;\;\;\;\mathsf{fma}\left(a, t + z \cdot b, \mathsf{fma}\left(y, z, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(z \cdot \mathsf{fma}\left(a, b, y\right) + a \cdot t\right)\\
\end{array}
\end{array}
if a < -1.2999999999999999e109Initial program 79.5%
associate-+l+79.5%
+-commutative79.5%
*-commutative79.5%
associate-*l*84.9%
distribute-lft-out92.4%
fma-def98.1%
+-commutative98.1%
fma-def98.1%
Simplified98.1%
if -1.2999999999999999e109 < a Initial program 96.3%
+-commutative96.3%
+-commutative96.3%
associate-+l+96.3%
associate-+r+96.3%
*-commutative96.3%
associate-*l*97.1%
*-commutative97.1%
distribute-lft-out98.1%
fma-def98.1%
fma-def98.1%
+-commutative98.1%
fma-def98.1%
Simplified98.1%
fma-udef98.1%
fma-udef98.1%
associate-+r+98.1%
*-commutative98.1%
Applied egg-rr98.1%
Final simplification98.1%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -6.2e+168) (not (<= z 2.1e+134))) (+ x (* z (+ y (* a b)))) (+ (* a (+ t (* z b))) (+ x (* z y)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -6.2e+168) || !(z <= 2.1e+134)) {
tmp = x + (z * (y + (a * b)));
} else {
tmp = (a * (t + (z * b))) + (x + (z * y));
}
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 <= (-6.2d+168)) .or. (.not. (z <= 2.1d+134))) then
tmp = x + (z * (y + (a * b)))
else
tmp = (a * (t + (z * b))) + (x + (z * y))
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 <= -6.2e+168) || !(z <= 2.1e+134)) {
tmp = x + (z * (y + (a * b)));
} else {
tmp = (a * (t + (z * b))) + (x + (z * y));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -6.2e+168) or not (z <= 2.1e+134): tmp = x + (z * (y + (a * b))) else: tmp = (a * (t + (z * b))) + (x + (z * y)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -6.2e+168) || !(z <= 2.1e+134)) tmp = Float64(x + Float64(z * Float64(y + Float64(a * b)))); else tmp = Float64(Float64(a * Float64(t + Float64(z * b))) + Float64(x + Float64(z * y))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -6.2e+168) || ~((z <= 2.1e+134))) tmp = x + (z * (y + (a * b))); else tmp = (a * (t + (z * b))) + (x + (z * y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -6.2e+168], N[Not[LessEqual[z, 2.1e+134]], $MachinePrecision]], N[(x + N[(z * N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * N[(t + N[(z * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x + N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.2 \cdot 10^{+168} \lor \neg \left(z \leq 2.1 \cdot 10^{+134}\right):\\
\;\;\;\;x + z \cdot \left(y + a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(t + z \cdot b\right) + \left(x + z \cdot y\right)\\
\end{array}
\end{array}
if z < -6.19999999999999993e168 or 2.1000000000000001e134 < z Initial program 86.0%
+-commutative86.0%
+-commutative86.0%
associate-+l+86.0%
associate-+r+86.0%
*-commutative86.0%
associate-*l*90.6%
*-commutative90.6%
distribute-lft-out95.3%
fma-def96.8%
fma-def96.8%
+-commutative96.8%
fma-def96.8%
Simplified96.8%
Taylor expanded in t around 0 96.8%
if -6.19999999999999993e168 < z < 2.1000000000000001e134Initial program 95.1%
associate-+l+95.1%
associate-*l*96.3%
Simplified96.3%
Taylor expanded in a around 0 99.5%
Final simplification98.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -2e-181) (not (<= a 4.5e-97))) (+ x (* a (+ t (* z b)))) (+ x (* z y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -2e-181) || !(a <= 4.5e-97)) {
tmp = x + (a * (t + (z * b)));
} else {
tmp = x + (z * y);
}
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 ((a <= (-2d-181)) .or. (.not. (a <= 4.5d-97))) then
tmp = x + (a * (t + (z * b)))
else
tmp = x + (z * y)
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 ((a <= -2e-181) || !(a <= 4.5e-97)) {
tmp = x + (a * (t + (z * b)));
} else {
tmp = x + (z * y);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a <= -2e-181) or not (a <= 4.5e-97): tmp = x + (a * (t + (z * b))) else: tmp = x + (z * y) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -2e-181) || !(a <= 4.5e-97)) tmp = Float64(x + Float64(a * Float64(t + Float64(z * b)))); else tmp = Float64(x + Float64(z * y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((a <= -2e-181) || ~((a <= 4.5e-97))) tmp = x + (a * (t + (z * b))); else tmp = x + (z * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -2e-181], N[Not[LessEqual[a, 4.5e-97]], $MachinePrecision]], N[(x + N[(a * N[(t + N[(z * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2 \cdot 10^{-181} \lor \neg \left(a \leq 4.5 \cdot 10^{-97}\right):\\
\;\;\;\;x + a \cdot \left(t + z \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot y\\
\end{array}
\end{array}
if a < -2.00000000000000009e-181 or 4.5000000000000001e-97 < a Initial program 90.1%
associate-+l+90.1%
+-commutative90.1%
*-commutative90.1%
associate-*l*92.4%
distribute-lft-out95.7%
fma-def97.3%
+-commutative97.3%
fma-def97.3%
Simplified97.3%
Taylor expanded in y around 0 89.2%
if -2.00000000000000009e-181 < a < 4.5000000000000001e-97Initial program 100.0%
associate-+l+100.0%
associate-*l*89.3%
Simplified89.3%
Taylor expanded in a around 0 85.3%
Final simplification88.2%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -5.9e-11) (not (<= a 2.1e-53))) (+ x (* a (+ t (* z b)))) (+ x (* z (+ y (* a b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -5.9e-11) || !(a <= 2.1e-53)) {
tmp = x + (a * (t + (z * b)));
} else {
tmp = x + (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 ((a <= (-5.9d-11)) .or. (.not. (a <= 2.1d-53))) then
tmp = x + (a * (t + (z * b)))
else
tmp = x + (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 ((a <= -5.9e-11) || !(a <= 2.1e-53)) {
tmp = x + (a * (t + (z * b)));
} else {
tmp = x + (z * (y + (a * b)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a <= -5.9e-11) or not (a <= 2.1e-53): tmp = x + (a * (t + (z * b))) else: tmp = x + (z * (y + (a * b))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -5.9e-11) || !(a <= 2.1e-53)) tmp = Float64(x + Float64(a * Float64(t + Float64(z * b)))); else tmp = Float64(x + 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 ((a <= -5.9e-11) || ~((a <= 2.1e-53))) tmp = x + (a * (t + (z * b))); else tmp = x + (z * (y + (a * b))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -5.9e-11], N[Not[LessEqual[a, 2.1e-53]], $MachinePrecision]], N[(x + N[(a * N[(t + N[(z * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.9 \cdot 10^{-11} \lor \neg \left(a \leq 2.1 \cdot 10^{-53}\right):\\
\;\;\;\;x + a \cdot \left(t + z \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(y + a \cdot b\right)\\
\end{array}
\end{array}
if a < -5.9000000000000003e-11 or 2.09999999999999977e-53 < a Initial program 88.1%
associate-+l+88.1%
+-commutative88.1%
*-commutative88.1%
associate-*l*92.2%
distribute-lft-out96.4%
fma-def98.5%
+-commutative98.5%
fma-def98.5%
Simplified98.5%
Taylor expanded in y around 0 93.0%
if -5.9000000000000003e-11 < a < 2.09999999999999977e-53Initial program 98.8%
+-commutative98.8%
+-commutative98.8%
associate-+l+98.8%
associate-+r+98.8%
*-commutative98.8%
associate-*l*99.1%
*-commutative99.1%
distribute-lft-out100.0%
fma-def100.0%
fma-def100.0%
+-commutative100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in t around 0 88.1%
Final simplification90.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -1.15e-20) (not (<= a 7.8e-96))) (+ x (* a (+ t (* z b)))) (+ (* a t) (+ x (* z y)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -1.15e-20) || !(a <= 7.8e-96)) {
tmp = x + (a * (t + (z * b)));
} else {
tmp = (a * t) + (x + (z * y));
}
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 ((a <= (-1.15d-20)) .or. (.not. (a <= 7.8d-96))) then
tmp = x + (a * (t + (z * b)))
else
tmp = (a * t) + (x + (z * y))
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 ((a <= -1.15e-20) || !(a <= 7.8e-96)) {
tmp = x + (a * (t + (z * b)));
} else {
tmp = (a * t) + (x + (z * y));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a <= -1.15e-20) or not (a <= 7.8e-96): tmp = x + (a * (t + (z * b))) else: tmp = (a * t) + (x + (z * y)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -1.15e-20) || !(a <= 7.8e-96)) tmp = Float64(x + Float64(a * Float64(t + Float64(z * b)))); else tmp = Float64(Float64(a * t) + Float64(x + Float64(z * y))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((a <= -1.15e-20) || ~((a <= 7.8e-96))) tmp = x + (a * (t + (z * b))); else tmp = (a * t) + (x + (z * y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -1.15e-20], N[Not[LessEqual[a, 7.8e-96]], $MachinePrecision]], N[(x + N[(a * N[(t + N[(z * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * t), $MachinePrecision] + N[(x + N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.15 \cdot 10^{-20} \lor \neg \left(a \leq 7.8 \cdot 10^{-96}\right):\\
\;\;\;\;x + a \cdot \left(t + z \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot t + \left(x + z \cdot y\right)\\
\end{array}
\end{array}
if a < -1.15e-20 or 7.7999999999999997e-96 < a Initial program 88.9%
associate-+l+88.9%
+-commutative88.9%
*-commutative88.9%
associate-*l*92.7%
distribute-lft-out96.6%
fma-def98.6%
+-commutative98.6%
fma-def98.6%
Simplified98.6%
Taylor expanded in y around 0 92.8%
if -1.15e-20 < a < 7.7999999999999997e-96Initial program 98.6%
associate-+l+98.6%
associate-*l*89.9%
Simplified89.9%
Taylor expanded in t around inf 90.5%
Final simplification91.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -1.56e+18) (not (<= z 5.8e+89))) (* z (+ y (* a b))) (+ x (* a t))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -1.56e+18) || !(z <= 5.8e+89)) {
tmp = z * (y + (a * b));
} else {
tmp = x + (a * t);
}
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 <= (-1.56d+18)) .or. (.not. (z <= 5.8d+89))) then
tmp = z * (y + (a * b))
else
tmp = x + (a * t)
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 <= -1.56e+18) || !(z <= 5.8e+89)) {
tmp = z * (y + (a * b));
} else {
tmp = x + (a * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -1.56e+18) or not (z <= 5.8e+89): tmp = z * (y + (a * b)) else: tmp = x + (a * t) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -1.56e+18) || !(z <= 5.8e+89)) tmp = Float64(z * Float64(y + Float64(a * b))); else tmp = Float64(x + Float64(a * t)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -1.56e+18) || ~((z <= 5.8e+89))) tmp = z * (y + (a * b)); else tmp = x + (a * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -1.56e+18], N[Not[LessEqual[z, 5.8e+89]], $MachinePrecision]], N[(z * N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(a * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.56 \cdot 10^{+18} \lor \neg \left(z \leq 5.8 \cdot 10^{+89}\right):\\
\;\;\;\;z \cdot \left(y + a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x + a \cdot t\\
\end{array}
\end{array}
if z < -1.56e18 or 5.80000000000000051e89 < z Initial program 85.6%
associate-+l+85.6%
associate-*l*82.7%
Simplified82.7%
Taylor expanded in z around inf 79.2%
if -1.56e18 < z < 5.80000000000000051e89Initial program 97.2%
associate-+l+97.2%
associate-*l*96.8%
Simplified96.8%
Taylor expanded in z around 0 75.8%
Final simplification77.1%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -1.1e-20) (not (<= a 7.6e-29))) (* a (+ t (* z b))) (+ x (* z y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -1.1e-20) || !(a <= 7.6e-29)) {
tmp = a * (t + (z * b));
} else {
tmp = x + (z * y);
}
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 ((a <= (-1.1d-20)) .or. (.not. (a <= 7.6d-29))) then
tmp = a * (t + (z * b))
else
tmp = x + (z * y)
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 ((a <= -1.1e-20) || !(a <= 7.6e-29)) {
tmp = a * (t + (z * b));
} else {
tmp = x + (z * y);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a <= -1.1e-20) or not (a <= 7.6e-29): tmp = a * (t + (z * b)) else: tmp = x + (z * y) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -1.1e-20) || !(a <= 7.6e-29)) tmp = Float64(a * Float64(t + Float64(z * b))); else tmp = Float64(x + Float64(z * y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((a <= -1.1e-20) || ~((a <= 7.6e-29))) tmp = a * (t + (z * b)); else tmp = x + (z * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -1.1e-20], N[Not[LessEqual[a, 7.6e-29]], $MachinePrecision]], N[(a * N[(t + N[(z * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.1 \cdot 10^{-20} \lor \neg \left(a \leq 7.6 \cdot 10^{-29}\right):\\
\;\;\;\;a \cdot \left(t + z \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot y\\
\end{array}
\end{array}
if a < -1.09999999999999995e-20 or 7.59999999999999951e-29 < a Initial program 87.7%
associate-+l+87.7%
associate-*l*91.9%
Simplified91.9%
Taylor expanded in a around 0 96.3%
Taylor expanded in a around -inf 79.5%
if -1.09999999999999995e-20 < a < 7.59999999999999951e-29Initial program 98.8%
associate-+l+98.8%
associate-*l*91.2%
Simplified91.2%
Taylor expanded in a around 0 77.3%
Final simplification78.5%
(FPCore (x y z t a b) :precision binary64 (if (<= t -7.5e-69) (* a t) (if (<= t -2.9e-280) (* z y) (if (<= t 1.8e+159) x (* a t)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -7.5e-69) {
tmp = a * t;
} else if (t <= -2.9e-280) {
tmp = z * y;
} else if (t <= 1.8e+159) {
tmp = x;
} else {
tmp = a * t;
}
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 <= (-7.5d-69)) then
tmp = a * t
else if (t <= (-2.9d-280)) then
tmp = z * y
else if (t <= 1.8d+159) then
tmp = x
else
tmp = a * t
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 <= -7.5e-69) {
tmp = a * t;
} else if (t <= -2.9e-280) {
tmp = z * y;
} else if (t <= 1.8e+159) {
tmp = x;
} else {
tmp = a * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -7.5e-69: tmp = a * t elif t <= -2.9e-280: tmp = z * y elif t <= 1.8e+159: tmp = x else: tmp = a * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -7.5e-69) tmp = Float64(a * t); elseif (t <= -2.9e-280) tmp = Float64(z * y); elseif (t <= 1.8e+159) tmp = x; else tmp = Float64(a * t); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -7.5e-69) tmp = a * t; elseif (t <= -2.9e-280) tmp = z * y; elseif (t <= 1.8e+159) tmp = x; else tmp = a * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -7.5e-69], N[(a * t), $MachinePrecision], If[LessEqual[t, -2.9e-280], N[(z * y), $MachinePrecision], If[LessEqual[t, 1.8e+159], x, N[(a * t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.5 \cdot 10^{-69}:\\
\;\;\;\;a \cdot t\\
\mathbf{elif}\;t \leq -2.9 \cdot 10^{-280}:\\
\;\;\;\;z \cdot y\\
\mathbf{elif}\;t \leq 1.8 \cdot 10^{+159}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;a \cdot t\\
\end{array}
\end{array}
if t < -7.5e-69 or 1.80000000000000018e159 < t Initial program 87.8%
associate-+l+87.8%
associate-*l*88.7%
Simplified88.7%
Taylor expanded in a around 0 94.0%
Taylor expanded in a around -inf 72.7%
Taylor expanded in t around inf 61.8%
if -7.5e-69 < t < -2.9e-280Initial program 94.6%
associate-+l+94.6%
associate-*l*95.5%
Simplified95.5%
Taylor expanded in y around inf 47.5%
*-commutative47.5%
Simplified47.5%
if -2.9e-280 < t < 1.80000000000000018e159Initial program 97.9%
associate-+l+97.9%
associate-*l*93.1%
Simplified93.1%
Taylor expanded in x around inf 41.8%
Final simplification51.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -1.5e+19) (not (<= z 4.4e+81))) (+ x (* z y)) (+ x (* a t))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -1.5e+19) || !(z <= 4.4e+81)) {
tmp = x + (z * y);
} else {
tmp = x + (a * t);
}
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 <= (-1.5d+19)) .or. (.not. (z <= 4.4d+81))) then
tmp = x + (z * y)
else
tmp = x + (a * t)
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 <= -1.5e+19) || !(z <= 4.4e+81)) {
tmp = x + (z * y);
} else {
tmp = x + (a * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -1.5e+19) or not (z <= 4.4e+81): tmp = x + (z * y) else: tmp = x + (a * t) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -1.5e+19) || !(z <= 4.4e+81)) tmp = Float64(x + Float64(z * y)); else tmp = Float64(x + Float64(a * t)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -1.5e+19) || ~((z <= 4.4e+81))) tmp = x + (z * y); else tmp = x + (a * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -1.5e+19], N[Not[LessEqual[z, 4.4e+81]], $MachinePrecision]], N[(x + N[(z * y), $MachinePrecision]), $MachinePrecision], N[(x + N[(a * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.5 \cdot 10^{+19} \lor \neg \left(z \leq 4.4 \cdot 10^{+81}\right):\\
\;\;\;\;x + z \cdot y\\
\mathbf{else}:\\
\;\;\;\;x + a \cdot t\\
\end{array}
\end{array}
if z < -1.5e19 or 4.39999999999999974e81 < z Initial program 85.6%
associate-+l+85.6%
associate-*l*82.7%
Simplified82.7%
Taylor expanded in a around 0 62.4%
if -1.5e19 < z < 4.39999999999999974e81Initial program 97.2%
associate-+l+97.2%
associate-*l*96.8%
Simplified96.8%
Taylor expanded in z around 0 75.8%
Final simplification70.8%
(FPCore (x y z t a b) :precision binary64 (if (<= z -5e+68) (* z y) (if (<= z 4.8e+182) (+ x (* a t)) (* z (* a b)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -5e+68) {
tmp = z * y;
} else if (z <= 4.8e+182) {
tmp = x + (a * t);
} else {
tmp = z * (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 <= (-5d+68)) then
tmp = z * y
else if (z <= 4.8d+182) then
tmp = x + (a * t)
else
tmp = z * (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 <= -5e+68) {
tmp = z * y;
} else if (z <= 4.8e+182) {
tmp = x + (a * t);
} else {
tmp = z * (a * b);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= -5e+68: tmp = z * y elif z <= 4.8e+182: tmp = x + (a * t) else: tmp = z * (a * b) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -5e+68) tmp = Float64(z * y); elseif (z <= 4.8e+182) tmp = Float64(x + Float64(a * t)); else tmp = Float64(z * Float64(a * b)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= -5e+68) tmp = z * y; elseif (z <= 4.8e+182) tmp = x + (a * t); else tmp = z * (a * b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -5e+68], N[(z * y), $MachinePrecision], If[LessEqual[z, 4.8e+182], N[(x + N[(a * t), $MachinePrecision]), $MachinePrecision], N[(z * N[(a * b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{+68}:\\
\;\;\;\;z \cdot y\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{+182}:\\
\;\;\;\;x + a \cdot t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(a \cdot b\right)\\
\end{array}
\end{array}
if z < -5.0000000000000004e68Initial program 83.6%
associate-+l+83.6%
associate-*l*79.8%
Simplified79.8%
Taylor expanded in y around inf 57.3%
*-commutative57.3%
Simplified57.3%
if -5.0000000000000004e68 < z < 4.80000000000000019e182Initial program 96.0%
associate-+l+96.0%
associate-*l*96.7%
Simplified96.7%
Taylor expanded in z around 0 72.2%
if 4.80000000000000019e182 < z Initial program 87.0%
associate-+l+87.0%
associate-*l*74.5%
Simplified74.5%
Taylor expanded in z around inf 95.7%
Taylor expanded in a around inf 65.9%
Final simplification68.9%
(FPCore (x y z t a b) :precision binary64 (if (<= t -9.5e-163) (* a t) (if (<= t 1.8e+159) x (* a t))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -9.5e-163) {
tmp = a * t;
} else if (t <= 1.8e+159) {
tmp = x;
} else {
tmp = a * t;
}
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 <= (-9.5d-163)) then
tmp = a * t
else if (t <= 1.8d+159) then
tmp = x
else
tmp = a * t
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 <= -9.5e-163) {
tmp = a * t;
} else if (t <= 1.8e+159) {
tmp = x;
} else {
tmp = a * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -9.5e-163: tmp = a * t elif t <= 1.8e+159: tmp = x else: tmp = a * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -9.5e-163) tmp = Float64(a * t); elseif (t <= 1.8e+159) tmp = x; else tmp = Float64(a * t); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -9.5e-163) tmp = a * t; elseif (t <= 1.8e+159) tmp = x; else tmp = a * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -9.5e-163], N[(a * t), $MachinePrecision], If[LessEqual[t, 1.8e+159], x, N[(a * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9.5 \cdot 10^{-163}:\\
\;\;\;\;a \cdot t\\
\mathbf{elif}\;t \leq 1.8 \cdot 10^{+159}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;a \cdot t\\
\end{array}
\end{array}
if t < -9.50000000000000012e-163 or 1.80000000000000018e159 < t Initial program 89.0%
associate-+l+89.0%
associate-*l*89.9%
Simplified89.9%
Taylor expanded in a around 0 94.3%
Taylor expanded in a around -inf 68.7%
Taylor expanded in t around inf 53.8%
if -9.50000000000000012e-163 < t < 1.80000000000000018e159Initial program 97.2%
associate-+l+97.2%
associate-*l*93.5%
Simplified93.5%
Taylor expanded in x around inf 38.5%
Final simplification46.6%
(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 92.9%
associate-+l+92.9%
associate-*l*91.6%
Simplified91.6%
Taylor expanded in x around inf 25.8%
Final simplification25.8%
(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 2023229
(FPCore (x y z t a b)
:name "Graphics.Rasterific.CubicBezier:cachedBezierAt from Rasterific-0.6.1"
:precision binary64
:herbie-target
(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)))