
(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 12 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 (<= b 4e-5) (fma a (+ t (* b z)) (fma y z x)) (+ (+ (* a t) (+ x (* z y))) (* b (* a z)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= 4e-5) {
tmp = fma(a, (t + (b * z)), fma(y, z, x));
} else {
tmp = ((a * t) + (x + (z * y))) + (b * (a * z));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= 4e-5) tmp = fma(a, Float64(t + Float64(b * z)), fma(y, z, x)); else tmp = Float64(Float64(Float64(a * t) + Float64(x + Float64(z * y))) + Float64(b * Float64(a * z))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, 4e-5], N[(a * N[(t + N[(b * z), $MachinePrecision]), $MachinePrecision] + N[(y * z + x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a * t), $MachinePrecision] + N[(x + N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(b * N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 4 \cdot 10^{-5}:\\
\;\;\;\;\mathsf{fma}\left(a, t + b \cdot z, \mathsf{fma}\left(y, z, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot t + \left(x + z \cdot y\right)\right) + b \cdot \left(a \cdot z\right)\\
\end{array}
\end{array}
if b < 4.00000000000000033e-5Initial program 92.5%
associate-+l+92.5%
+-commutative92.5%
*-commutative92.5%
*-commutative92.5%
associate-*l*95.0%
distribute-rgt-out96.5%
fma-def97.1%
*-commutative97.1%
+-commutative97.1%
fma-def97.1%
Simplified97.1%
if 4.00000000000000033e-5 < b Initial program 98.3%
Final simplification97.3%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (+ (+ (* a t) (+ x (* z y))) (* b (* a z))))) (if (<= t_1 5e+298) t_1 (+ (* z y) (* a (+ t (* b z)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((a * t) + (x + (z * y))) + (b * (a * z));
double tmp;
if (t_1 <= 5e+298) {
tmp = t_1;
} else {
tmp = (z * y) + (a * (t + (b * z)));
}
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 * t) + (x + (z * y))) + (b * (a * z))
if (t_1 <= 5d+298) then
tmp = t_1
else
tmp = (z * y) + (a * (t + (b * z)))
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 * t) + (x + (z * y))) + (b * (a * z));
double tmp;
if (t_1 <= 5e+298) {
tmp = t_1;
} else {
tmp = (z * y) + (a * (t + (b * z)));
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = ((a * t) + (x + (z * y))) + (b * (a * z)) tmp = 0 if t_1 <= 5e+298: tmp = t_1 else: tmp = (z * y) + (a * (t + (b * z))) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(a * t) + Float64(x + Float64(z * y))) + Float64(b * Float64(a * z))) tmp = 0.0 if (t_1 <= 5e+298) tmp = t_1; else tmp = Float64(Float64(z * y) + Float64(a * Float64(t + Float64(b * z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = ((a * t) + (x + (z * y))) + (b * (a * z)); tmp = 0.0; if (t_1 <= 5e+298) tmp = t_1; else tmp = (z * y) + (a * (t + (b * z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(a * t), $MachinePrecision] + N[(x + N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(b * N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e+298], t$95$1, N[(N[(z * y), $MachinePrecision] + N[(a * N[(t + N[(b * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a \cdot t + \left(x + z \cdot y\right)\right) + b \cdot \left(a \cdot z\right)\\
\mathbf{if}\;t_1 \leq 5 \cdot 10^{+298}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot y + a \cdot \left(t + b \cdot z\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b)) < 5.0000000000000003e298Initial program 98.1%
if 5.0000000000000003e298 < (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b)) Initial program 76.2%
associate-+l+76.2%
+-commutative76.2%
*-commutative76.2%
*-commutative76.2%
associate-*l*86.0%
distribute-rgt-out92.0%
fma-def94.0%
*-commutative94.0%
+-commutative94.0%
fma-def94.0%
Simplified94.0%
Taylor expanded in x around 0 92.0%
Final simplification96.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* a (* b z))))
(if (<= a -1.12e-35)
(* a t)
(if (<= a -1.1e-89)
x
(if (<= a -6.8e-115)
t_1
(if (<= a 7.8e+14)
(* z y)
(if (or (<= a 6.7e+156) (not (<= a 9e+279))) t_1 (* a t))))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a * (b * z);
double tmp;
if (a <= -1.12e-35) {
tmp = a * t;
} else if (a <= -1.1e-89) {
tmp = x;
} else if (a <= -6.8e-115) {
tmp = t_1;
} else if (a <= 7.8e+14) {
tmp = z * y;
} else if ((a <= 6.7e+156) || !(a <= 9e+279)) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = a * (b * z)
if (a <= (-1.12d-35)) then
tmp = a * t
else if (a <= (-1.1d-89)) then
tmp = x
else if (a <= (-6.8d-115)) then
tmp = t_1
else if (a <= 7.8d+14) then
tmp = z * y
else if ((a <= 6.7d+156) .or. (.not. (a <= 9d+279))) then
tmp = t_1
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 t_1 = a * (b * z);
double tmp;
if (a <= -1.12e-35) {
tmp = a * t;
} else if (a <= -1.1e-89) {
tmp = x;
} else if (a <= -6.8e-115) {
tmp = t_1;
} else if (a <= 7.8e+14) {
tmp = z * y;
} else if ((a <= 6.7e+156) || !(a <= 9e+279)) {
tmp = t_1;
} else {
tmp = a * t;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = a * (b * z) tmp = 0 if a <= -1.12e-35: tmp = a * t elif a <= -1.1e-89: tmp = x elif a <= -6.8e-115: tmp = t_1 elif a <= 7.8e+14: tmp = z * y elif (a <= 6.7e+156) or not (a <= 9e+279): tmp = t_1 else: tmp = a * t return tmp
function code(x, y, z, t, a, b) t_1 = Float64(a * Float64(b * z)) tmp = 0.0 if (a <= -1.12e-35) tmp = Float64(a * t); elseif (a <= -1.1e-89) tmp = x; elseif (a <= -6.8e-115) tmp = t_1; elseif (a <= 7.8e+14) tmp = Float64(z * y); elseif ((a <= 6.7e+156) || !(a <= 9e+279)) tmp = t_1; else tmp = Float64(a * t); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = a * (b * z); tmp = 0.0; if (a <= -1.12e-35) tmp = a * t; elseif (a <= -1.1e-89) tmp = x; elseif (a <= -6.8e-115) tmp = t_1; elseif (a <= 7.8e+14) tmp = z * y; elseif ((a <= 6.7e+156) || ~((a <= 9e+279))) tmp = t_1; else tmp = a * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a * N[(b * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -1.12e-35], N[(a * t), $MachinePrecision], If[LessEqual[a, -1.1e-89], x, If[LessEqual[a, -6.8e-115], t$95$1, If[LessEqual[a, 7.8e+14], N[(z * y), $MachinePrecision], If[Or[LessEqual[a, 6.7e+156], N[Not[LessEqual[a, 9e+279]], $MachinePrecision]], t$95$1, N[(a * t), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot \left(b \cdot z\right)\\
\mathbf{if}\;a \leq -1.12 \cdot 10^{-35}:\\
\;\;\;\;a \cdot t\\
\mathbf{elif}\;a \leq -1.1 \cdot 10^{-89}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq -6.8 \cdot 10^{-115}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq 7.8 \cdot 10^{+14}:\\
\;\;\;\;z \cdot y\\
\mathbf{elif}\;a \leq 6.7 \cdot 10^{+156} \lor \neg \left(a \leq 9 \cdot 10^{+279}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;a \cdot t\\
\end{array}
\end{array}
if a < -1.12e-35 or 6.7e156 < a < 8.9999999999999999e279Initial program 89.1%
*-commutative89.1%
associate-*l*91.1%
Simplified91.1%
Taylor expanded in t around inf 51.7%
if -1.12e-35 < a < -1.10000000000000006e-89Initial program 99.8%
*-commutative99.8%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in x around inf 47.3%
if -1.10000000000000006e-89 < a < -6.7999999999999996e-115 or 7.8e14 < a < 6.7e156 or 8.9999999999999999e279 < a Initial program 88.3%
*-commutative88.3%
associate-*l*88.3%
Simplified88.3%
Taylor expanded in z around inf 60.2%
Taylor expanded in a around inf 57.9%
*-commutative57.9%
Simplified57.9%
if -6.7999999999999996e-115 < a < 7.8e14Initial program 99.1%
*-commutative99.1%
associate-*l*99.0%
Simplified99.0%
Taylor expanded in y around inf 48.5%
*-commutative48.5%
Simplified48.5%
Final simplification50.9%
(FPCore (x y z t a b) :precision binary64 (if (<= a 5.8e+168) (+ (+ (* a t) (+ x (* z y))) (* z (* b a))) (* a (+ t (* b z)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= 5.8e+168) {
tmp = ((a * t) + (x + (z * y))) + (z * (b * a));
} else {
tmp = a * (t + (b * z));
}
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.8d+168) then
tmp = ((a * t) + (x + (z * y))) + (z * (b * a))
else
tmp = a * (t + (b * z))
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.8e+168) {
tmp = ((a * t) + (x + (z * y))) + (z * (b * a));
} else {
tmp = a * (t + (b * z));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= 5.8e+168: tmp = ((a * t) + (x + (z * y))) + (z * (b * a)) else: tmp = a * (t + (b * z)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= 5.8e+168) tmp = Float64(Float64(Float64(a * t) + Float64(x + Float64(z * y))) + Float64(z * Float64(b * a))); else tmp = Float64(a * Float64(t + Float64(b * z))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (a <= 5.8e+168) tmp = ((a * t) + (x + (z * y))) + (z * (b * a)); else tmp = a * (t + (b * z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, 5.8e+168], N[(N[(N[(a * t), $MachinePrecision] + N[(x + N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(z * N[(b * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(t + N[(b * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 5.8 \cdot 10^{+168}:\\
\;\;\;\;\left(a \cdot t + \left(x + z \cdot y\right)\right) + z \cdot \left(b \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(t + b \cdot z\right)\\
\end{array}
\end{array}
if a < 5.8e168Initial program 95.2%
*-commutative95.2%
associate-*l*96.1%
Simplified96.1%
if 5.8e168 < a Initial program 83.1%
*-commutative83.1%
associate-*l*82.7%
Simplified82.7%
Taylor expanded in a around inf 96.8%
Final simplification96.2%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -1.75e+48) (not (<= a 3.8e+20))) (* a (+ t (* b z))) (+ (* z y) (+ x (* a t)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -1.75e+48) || !(a <= 3.8e+20)) {
tmp = a * (t + (b * z));
} else {
tmp = (z * y) + (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 ((a <= (-1.75d+48)) .or. (.not. (a <= 3.8d+20))) then
tmp = a * (t + (b * z))
else
tmp = (z * y) + (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 ((a <= -1.75e+48) || !(a <= 3.8e+20)) {
tmp = a * (t + (b * z));
} else {
tmp = (z * y) + (x + (a * t));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a <= -1.75e+48) or not (a <= 3.8e+20): tmp = a * (t + (b * z)) else: tmp = (z * y) + (x + (a * t)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -1.75e+48) || !(a <= 3.8e+20)) tmp = Float64(a * Float64(t + Float64(b * z))); else tmp = Float64(Float64(z * y) + Float64(x + Float64(a * t))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((a <= -1.75e+48) || ~((a <= 3.8e+20))) tmp = a * (t + (b * z)); else tmp = (z * y) + (x + (a * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -1.75e+48], N[Not[LessEqual[a, 3.8e+20]], $MachinePrecision]], N[(a * N[(t + N[(b * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z * y), $MachinePrecision] + N[(x + N[(a * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.75 \cdot 10^{+48} \lor \neg \left(a \leq 3.8 \cdot 10^{+20}\right):\\
\;\;\;\;a \cdot \left(t + b \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot y + \left(x + a \cdot t\right)\\
\end{array}
\end{array}
if a < -1.7499999999999999e48 or 3.8e20 < a Initial program 87.4%
*-commutative87.4%
associate-*l*89.0%
Simplified89.0%
Taylor expanded in a around inf 83.3%
if -1.7499999999999999e48 < a < 3.8e20Initial program 99.3%
*-commutative99.3%
associate-*l*99.2%
Simplified99.2%
Taylor expanded in b around 0 86.8%
Final simplification85.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* a (+ t (* b z)))))
(if (<= a -7.2e-20)
(+ (* z y) t_1)
(if (<= a 2.5e+21) (+ (* z y) (+ x (* a t))) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a * (t + (b * z));
double tmp;
if (a <= -7.2e-20) {
tmp = (z * y) + t_1;
} else if (a <= 2.5e+21) {
tmp = (z * y) + (x + (a * t));
} 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 = a * (t + (b * z))
if (a <= (-7.2d-20)) then
tmp = (z * y) + t_1
else if (a <= 2.5d+21) then
tmp = (z * y) + (x + (a * t))
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 = a * (t + (b * z));
double tmp;
if (a <= -7.2e-20) {
tmp = (z * y) + t_1;
} else if (a <= 2.5e+21) {
tmp = (z * y) + (x + (a * t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = a * (t + (b * z)) tmp = 0 if a <= -7.2e-20: tmp = (z * y) + t_1 elif a <= 2.5e+21: tmp = (z * y) + (x + (a * t)) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(a * Float64(t + Float64(b * z))) tmp = 0.0 if (a <= -7.2e-20) tmp = Float64(Float64(z * y) + t_1); elseif (a <= 2.5e+21) tmp = Float64(Float64(z * y) + Float64(x + Float64(a * t))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = a * (t + (b * z)); tmp = 0.0; if (a <= -7.2e-20) tmp = (z * y) + t_1; elseif (a <= 2.5e+21) tmp = (z * y) + (x + (a * t)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a * N[(t + N[(b * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -7.2e-20], N[(N[(z * y), $MachinePrecision] + t$95$1), $MachinePrecision], If[LessEqual[a, 2.5e+21], N[(N[(z * y), $MachinePrecision] + N[(x + N[(a * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot \left(t + b \cdot z\right)\\
\mathbf{if}\;a \leq -7.2 \cdot 10^{-20}:\\
\;\;\;\;z \cdot y + t_1\\
\mathbf{elif}\;a \leq 2.5 \cdot 10^{+21}:\\
\;\;\;\;z \cdot y + \left(x + a \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if a < -7.19999999999999948e-20Initial program 91.9%
associate-+l+91.9%
+-commutative91.9%
*-commutative91.9%
*-commutative91.9%
associate-*l*98.5%
distribute-rgt-out99.9%
fma-def100.0%
*-commutative100.0%
+-commutative100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in x around 0 89.6%
if -7.19999999999999948e-20 < a < 2.5e21Initial program 99.2%
*-commutative99.2%
associate-*l*99.2%
Simplified99.2%
Taylor expanded in b around 0 87.5%
if 2.5e21 < a Initial program 84.4%
*-commutative84.4%
associate-*l*86.0%
Simplified86.0%
Taylor expanded in a around inf 87.1%
Final simplification88.0%
(FPCore (x y z t a b)
:precision binary64
(if (<= a -2.6e-37)
(* a t)
(if (<= a -6.6e-96)
x
(if (<= a -2.6e-123) (* a t) (if (<= a 5.7e-25) (* z y) (* a t))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -2.6e-37) {
tmp = a * t;
} else if (a <= -6.6e-96) {
tmp = x;
} else if (a <= -2.6e-123) {
tmp = a * t;
} else if (a <= 5.7e-25) {
tmp = z * y;
} 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 (a <= (-2.6d-37)) then
tmp = a * t
else if (a <= (-6.6d-96)) then
tmp = x
else if (a <= (-2.6d-123)) then
tmp = a * t
else if (a <= 5.7d-25) then
tmp = z * y
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 (a <= -2.6e-37) {
tmp = a * t;
} else if (a <= -6.6e-96) {
tmp = x;
} else if (a <= -2.6e-123) {
tmp = a * t;
} else if (a <= 5.7e-25) {
tmp = z * y;
} else {
tmp = a * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= -2.6e-37: tmp = a * t elif a <= -6.6e-96: tmp = x elif a <= -2.6e-123: tmp = a * t elif a <= 5.7e-25: tmp = z * y else: tmp = a * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -2.6e-37) tmp = Float64(a * t); elseif (a <= -6.6e-96) tmp = x; elseif (a <= -2.6e-123) tmp = Float64(a * t); elseif (a <= 5.7e-25) tmp = Float64(z * y); else tmp = Float64(a * t); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (a <= -2.6e-37) tmp = a * t; elseif (a <= -6.6e-96) tmp = x; elseif (a <= -2.6e-123) tmp = a * t; elseif (a <= 5.7e-25) tmp = z * y; else tmp = a * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -2.6e-37], N[(a * t), $MachinePrecision], If[LessEqual[a, -6.6e-96], x, If[LessEqual[a, -2.6e-123], N[(a * t), $MachinePrecision], If[LessEqual[a, 5.7e-25], N[(z * y), $MachinePrecision], N[(a * t), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.6 \cdot 10^{-37}:\\
\;\;\;\;a \cdot t\\
\mathbf{elif}\;a \leq -6.6 \cdot 10^{-96}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq -2.6 \cdot 10^{-123}:\\
\;\;\;\;a \cdot t\\
\mathbf{elif}\;a \leq 5.7 \cdot 10^{-25}:\\
\;\;\;\;z \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot t\\
\end{array}
\end{array}
if a < -2.5999999999999998e-37 or -6.5999999999999998e-96 < a < -2.59999999999999995e-123 or 5.7000000000000004e-25 < a Initial program 89.5%
*-commutative89.5%
associate-*l*90.9%
Simplified90.9%
Taylor expanded in t around inf 45.4%
if -2.5999999999999998e-37 < a < -6.5999999999999998e-96Initial program 99.8%
*-commutative99.8%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in x around inf 47.3%
if -2.59999999999999995e-123 < a < 5.7000000000000004e-25Initial program 99.0%
*-commutative99.0%
associate-*l*99.0%
Simplified99.0%
Taylor expanded in y around inf 50.1%
*-commutative50.1%
Simplified50.1%
Final simplification47.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -8.8e-92) (not (<= z 2.1e+24))) (* z (+ y (* b a))) (+ x (* a t))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -8.8e-92) || !(z <= 2.1e+24)) {
tmp = z * (y + (b * a));
} 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 <= (-8.8d-92)) .or. (.not. (z <= 2.1d+24))) then
tmp = z * (y + (b * a))
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 <= -8.8e-92) || !(z <= 2.1e+24)) {
tmp = z * (y + (b * a));
} else {
tmp = x + (a * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -8.8e-92) or not (z <= 2.1e+24): tmp = z * (y + (b * a)) else: tmp = x + (a * t) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -8.8e-92) || !(z <= 2.1e+24)) tmp = Float64(z * Float64(y + Float64(b * a))); 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 <= -8.8e-92) || ~((z <= 2.1e+24))) tmp = z * (y + (b * a)); else tmp = x + (a * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -8.8e-92], N[Not[LessEqual[z, 2.1e+24]], $MachinePrecision]], N[(z * N[(y + N[(b * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(a * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.8 \cdot 10^{-92} \lor \neg \left(z \leq 2.1 \cdot 10^{+24}\right):\\
\;\;\;\;z \cdot \left(y + b \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;x + a \cdot t\\
\end{array}
\end{array}
if z < -8.79999999999999949e-92 or 2.1000000000000001e24 < z Initial program 89.8%
*-commutative89.8%
associate-*l*95.1%
Simplified95.1%
Taylor expanded in z around inf 73.0%
if -8.79999999999999949e-92 < z < 2.1000000000000001e24Initial program 99.1%
*-commutative99.1%
associate-*l*93.9%
Simplified93.9%
Taylor expanded in z around 0 78.5%
Final simplification75.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -8.5e+100) (not (<= b 6.2e+165))) (* z (* b a)) (+ x (* a t))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -8.5e+100) || !(b <= 6.2e+165)) {
tmp = z * (b * a);
} 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 ((b <= (-8.5d+100)) .or. (.not. (b <= 6.2d+165))) then
tmp = z * (b * a)
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 ((b <= -8.5e+100) || !(b <= 6.2e+165)) {
tmp = z * (b * a);
} else {
tmp = x + (a * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (b <= -8.5e+100) or not (b <= 6.2e+165): tmp = z * (b * a) else: tmp = x + (a * t) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -8.5e+100) || !(b <= 6.2e+165)) tmp = Float64(z * Float64(b * a)); 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 ((b <= -8.5e+100) || ~((b <= 6.2e+165))) tmp = z * (b * a); else tmp = x + (a * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -8.5e+100], N[Not[LessEqual[b, 6.2e+165]], $MachinePrecision]], N[(z * N[(b * a), $MachinePrecision]), $MachinePrecision], N[(x + N[(a * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -8.5 \cdot 10^{+100} \lor \neg \left(b \leq 6.2 \cdot 10^{+165}\right):\\
\;\;\;\;z \cdot \left(b \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;x + a \cdot t\\
\end{array}
\end{array}
if b < -8.50000000000000043e100 or 6.2000000000000003e165 < b Initial program 93.3%
*-commutative93.3%
associate-*l*86.9%
Simplified86.9%
Taylor expanded in z around inf 70.3%
Taylor expanded in a around inf 56.8%
if -8.50000000000000043e100 < b < 6.2000000000000003e165Initial program 94.1%
*-commutative94.1%
associate-*l*97.7%
Simplified97.7%
Taylor expanded in z around 0 59.9%
Final simplification59.0%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -2.6e-123) (not (<= a 2.15e-19))) (+ x (* a t)) (+ x (* z y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -2.6e-123) || !(a <= 2.15e-19)) {
tmp = x + (a * t);
} 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 <= (-2.6d-123)) .or. (.not. (a <= 2.15d-19))) then
tmp = x + (a * t)
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 <= -2.6e-123) || !(a <= 2.15e-19)) {
tmp = x + (a * t);
} else {
tmp = x + (z * y);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a <= -2.6e-123) or not (a <= 2.15e-19): tmp = x + (a * t) else: tmp = x + (z * y) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -2.6e-123) || !(a <= 2.15e-19)) tmp = Float64(x + Float64(a * t)); 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 <= -2.6e-123) || ~((a <= 2.15e-19))) tmp = x + (a * t); else tmp = x + (z * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -2.6e-123], N[Not[LessEqual[a, 2.15e-19]], $MachinePrecision]], N[(x + N[(a * t), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.6 \cdot 10^{-123} \lor \neg \left(a \leq 2.15 \cdot 10^{-19}\right):\\
\;\;\;\;x + a \cdot t\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot y\\
\end{array}
\end{array}
if a < -2.59999999999999995e-123 or 2.15e-19 < a Initial program 90.6%
*-commutative90.6%
associate-*l*91.8%
Simplified91.8%
Taylor expanded in z around 0 57.9%
if -2.59999999999999995e-123 < a < 2.15e-19Initial program 99.0%
*-commutative99.0%
associate-*l*99.0%
Simplified99.0%
Taylor expanded in a around 0 82.4%
Final simplification67.4%
(FPCore (x y z t a b) :precision binary64 (if (<= a -1.1e-36) (* a t) (if (<= a 9.3e-32) x (* a t))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -1.1e-36) {
tmp = a * t;
} else if (a <= 9.3e-32) {
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 (a <= (-1.1d-36)) then
tmp = a * t
else if (a <= 9.3d-32) 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 (a <= -1.1e-36) {
tmp = a * t;
} else if (a <= 9.3e-32) {
tmp = x;
} else {
tmp = a * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= -1.1e-36: tmp = a * t elif a <= 9.3e-32: tmp = x else: tmp = a * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -1.1e-36) tmp = Float64(a * t); elseif (a <= 9.3e-32) 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 (a <= -1.1e-36) tmp = a * t; elseif (a <= 9.3e-32) tmp = x; else tmp = a * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -1.1e-36], N[(a * t), $MachinePrecision], If[LessEqual[a, 9.3e-32], x, N[(a * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.1 \cdot 10^{-36}:\\
\;\;\;\;a \cdot t\\
\mathbf{elif}\;a \leq 9.3 \cdot 10^{-32}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;a \cdot t\\
\end{array}
\end{array}
if a < -1.1e-36 or 9.29999999999999977e-32 < a Initial program 89.2%
*-commutative89.2%
associate-*l*90.6%
Simplified90.6%
Taylor expanded in t around inf 45.2%
if -1.1e-36 < a < 9.29999999999999977e-32Initial program 99.1%
*-commutative99.1%
associate-*l*99.1%
Simplified99.1%
Taylor expanded in x around inf 36.2%
Final simplification41.0%
(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%
*-commutative93.8%
associate-*l*94.6%
Simplified94.6%
Taylor expanded in x around inf 23.2%
Final simplification23.2%
(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 2023279
(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)))