
(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 (or (<= z -5e+56) (not (<= z 1.95e-25))) (* z (+ y (+ (/ x z) (* a (+ b (/ t z)))))) (+ (+ x (* z y)) (+ (* a (* z b)) (* a t)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -5e+56) || !(z <= 1.95e-25)) {
tmp = z * (y + ((x / z) + (a * (b + (t / z)))));
} else {
tmp = (x + (z * y)) + ((a * (z * b)) + (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 <= (-5d+56)) .or. (.not. (z <= 1.95d-25))) then
tmp = z * (y + ((x / z) + (a * (b + (t / z)))))
else
tmp = (x + (z * y)) + ((a * (z * b)) + (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 <= -5e+56) || !(z <= 1.95e-25)) {
tmp = z * (y + ((x / z) + (a * (b + (t / z)))));
} else {
tmp = (x + (z * y)) + ((a * (z * b)) + (a * t));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -5e+56) or not (z <= 1.95e-25): tmp = z * (y + ((x / z) + (a * (b + (t / z))))) else: tmp = (x + (z * y)) + ((a * (z * b)) + (a * t)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -5e+56) || !(z <= 1.95e-25)) tmp = Float64(z * Float64(y + Float64(Float64(x / z) + Float64(a * Float64(b + Float64(t / z)))))); else tmp = Float64(Float64(x + Float64(z * y)) + Float64(Float64(a * Float64(z * b)) + Float64(a * t))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -5e+56) || ~((z <= 1.95e-25))) tmp = z * (y + ((x / z) + (a * (b + (t / z))))); else tmp = (x + (z * y)) + ((a * (z * b)) + (a * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -5e+56], N[Not[LessEqual[z, 1.95e-25]], $MachinePrecision]], N[(z * N[(y + N[(N[(x / z), $MachinePrecision] + N[(a * N[(b + N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(z * y), $MachinePrecision]), $MachinePrecision] + N[(N[(a * N[(z * b), $MachinePrecision]), $MachinePrecision] + N[(a * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{+56} \lor \neg \left(z \leq 1.95 \cdot 10^{-25}\right):\\
\;\;\;\;z \cdot \left(y + \left(\frac{x}{z} + a \cdot \left(b + \frac{t}{z}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x + z \cdot y\right) + \left(a \cdot \left(z \cdot b\right) + a \cdot t\right)\\
\end{array}
\end{array}
if z < -5.00000000000000024e56 or 1.95e-25 < z Initial program 83.4%
associate-+l+83.4%
associate-*l*83.6%
Simplified83.6%
Taylor expanded in z around inf 98.2%
+-commutative98.2%
associate-+l+98.2%
+-commutative98.2%
associate-/l*99.9%
distribute-lft-out99.9%
Simplified99.9%
if -5.00000000000000024e56 < z < 1.95e-25Initial program 98.5%
associate-+l+98.5%
associate-*l*99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -3.5e-154) (not (<= z 4.7e-88))) (* z (+ y (+ (/ x z) (* a (+ b (/ t z)))))) (+ x (+ (* a (* z b)) (* a t)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -3.5e-154) || !(z <= 4.7e-88)) {
tmp = z * (y + ((x / z) + (a * (b + (t / z)))));
} else {
tmp = x + ((a * (z * b)) + (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 <= (-3.5d-154)) .or. (.not. (z <= 4.7d-88))) then
tmp = z * (y + ((x / z) + (a * (b + (t / z)))))
else
tmp = x + ((a * (z * b)) + (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 <= -3.5e-154) || !(z <= 4.7e-88)) {
tmp = z * (y + ((x / z) + (a * (b + (t / z)))));
} else {
tmp = x + ((a * (z * b)) + (a * t));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -3.5e-154) or not (z <= 4.7e-88): tmp = z * (y + ((x / z) + (a * (b + (t / z))))) else: tmp = x + ((a * (z * b)) + (a * t)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -3.5e-154) || !(z <= 4.7e-88)) tmp = Float64(z * Float64(y + Float64(Float64(x / z) + Float64(a * Float64(b + Float64(t / z)))))); else tmp = Float64(x + Float64(Float64(a * Float64(z * b)) + Float64(a * t))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -3.5e-154) || ~((z <= 4.7e-88))) tmp = z * (y + ((x / z) + (a * (b + (t / z))))); else tmp = x + ((a * (z * b)) + (a * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -3.5e-154], N[Not[LessEqual[z, 4.7e-88]], $MachinePrecision]], N[(z * N[(y + N[(N[(x / z), $MachinePrecision] + N[(a * N[(b + N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(a * N[(z * b), $MachinePrecision]), $MachinePrecision] + N[(a * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.5 \cdot 10^{-154} \lor \neg \left(z \leq 4.7 \cdot 10^{-88}\right):\\
\;\;\;\;z \cdot \left(y + \left(\frac{x}{z} + a \cdot \left(b + \frac{t}{z}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(a \cdot \left(z \cdot b\right) + a \cdot t\right)\\
\end{array}
\end{array}
if z < -3.5000000000000001e-154 or 4.7e-88 < z Initial program 88.1%
associate-+l+88.1%
associate-*l*88.8%
Simplified88.8%
Taylor expanded in z around inf 95.5%
+-commutative95.5%
associate-+l+95.5%
+-commutative95.5%
associate-/l*96.0%
distribute-lft-out96.6%
Simplified96.6%
if -3.5000000000000001e-154 < z < 4.7e-88Initial program 98.7%
associate-+l+98.7%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in y around 0 92.7%
Final simplification95.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -1.9e+47) (not (<= y 4.5e+51))) (+ x (* y (+ z (/ (* a t) y)))) (+ x (* a (+ t (* z b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -1.9e+47) || !(y <= 4.5e+51)) {
tmp = x + (y * (z + ((a * t) / y)));
} 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.9d+47)) .or. (.not. (y <= 4.5d+51))) then
tmp = x + (y * (z + ((a * t) / y)))
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.9e+47) || !(y <= 4.5e+51)) {
tmp = x + (y * (z + ((a * t) / y)));
} else {
tmp = x + (a * (t + (z * b)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -1.9e+47) or not (y <= 4.5e+51): tmp = x + (y * (z + ((a * t) / y))) else: tmp = x + (a * (t + (z * b))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -1.9e+47) || !(y <= 4.5e+51)) tmp = Float64(x + Float64(y * Float64(z + Float64(Float64(a * t) / y)))); 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.9e+47) || ~((y <= 4.5e+51))) tmp = x + (y * (z + ((a * t) / y))); else tmp = x + (a * (t + (z * b))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -1.9e+47], N[Not[LessEqual[y, 4.5e+51]], $MachinePrecision]], N[(x + N[(y * N[(z + N[(N[(a * t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $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.9 \cdot 10^{+47} \lor \neg \left(y \leq 4.5 \cdot 10^{+51}\right):\\
\;\;\;\;x + y \cdot \left(z + \frac{a \cdot t}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;x + a \cdot \left(t + z \cdot b\right)\\
\end{array}
\end{array}
if y < -1.9000000000000002e47 or 4.5e51 < y Initial program 86.5%
associate-+l+86.5%
associate-*l*89.4%
Simplified89.4%
Taylor expanded in b around 0 85.9%
Taylor expanded in y around inf 88.8%
if -1.9000000000000002e47 < y < 4.5e51Initial program 94.7%
associate-+l+94.7%
+-commutative94.7%
fma-define94.7%
associate-*l*94.2%
*-commutative94.2%
*-commutative94.2%
distribute-rgt-out96.2%
*-commutative96.2%
Simplified96.2%
Taylor expanded in y around 0 90.0%
Final simplification89.5%
(FPCore (x y z t a b)
:precision binary64
(if (<= a -2.1e+275)
(* a t)
(if (<= a -2.6e+106)
(* a (* z b))
(if (<= a 1.02e+117) (+ x (* z y)) (* a t)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -2.1e+275) {
tmp = a * t;
} else if (a <= -2.6e+106) {
tmp = a * (z * b);
} else if (a <= 1.02e+117) {
tmp = x + (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.1d+275)) then
tmp = a * t
else if (a <= (-2.6d+106)) then
tmp = a * (z * b)
else if (a <= 1.02d+117) then
tmp = x + (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.1e+275) {
tmp = a * t;
} else if (a <= -2.6e+106) {
tmp = a * (z * b);
} else if (a <= 1.02e+117) {
tmp = x + (z * y);
} else {
tmp = a * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= -2.1e+275: tmp = a * t elif a <= -2.6e+106: tmp = a * (z * b) elif a <= 1.02e+117: tmp = x + (z * y) else: tmp = a * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -2.1e+275) tmp = Float64(a * t); elseif (a <= -2.6e+106) tmp = Float64(a * Float64(z * b)); elseif (a <= 1.02e+117) tmp = Float64(x + 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.1e+275) tmp = a * t; elseif (a <= -2.6e+106) tmp = a * (z * b); elseif (a <= 1.02e+117) tmp = x + (z * y); else tmp = a * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -2.1e+275], N[(a * t), $MachinePrecision], If[LessEqual[a, -2.6e+106], N[(a * N[(z * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.02e+117], N[(x + N[(z * y), $MachinePrecision]), $MachinePrecision], N[(a * t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.1 \cdot 10^{+275}:\\
\;\;\;\;a \cdot t\\
\mathbf{elif}\;a \leq -2.6 \cdot 10^{+106}:\\
\;\;\;\;a \cdot \left(z \cdot b\right)\\
\mathbf{elif}\;a \leq 1.02 \cdot 10^{+117}:\\
\;\;\;\;x + z \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot t\\
\end{array}
\end{array}
if a < -2.1000000000000001e275 or 1.02e117 < a Initial program 78.8%
associate-+l+78.8%
associate-*l*88.3%
Simplified88.3%
Taylor expanded in t around inf 55.1%
if -2.1000000000000001e275 < a < -2.6000000000000002e106Initial program 84.9%
associate-+l+84.9%
associate-*l*93.4%
Simplified93.4%
Taylor expanded in z around inf 55.4%
Taylor expanded in y around 0 49.8%
*-commutative49.8%
Simplified49.8%
if -2.6000000000000002e106 < a < 1.02e117Initial program 97.4%
associate-+l+97.4%
associate-*l*93.2%
Simplified93.2%
Taylor expanded in a around 0 71.0%
Final simplification64.0%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -1.25e+47) (not (<= y 3.5e+51))) (+ x (+ (* z y) (* a t))) (+ x (* a (+ t (* z b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -1.25e+47) || !(y <= 3.5e+51)) {
tmp = x + ((z * y) + (a * t));
} 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.25d+47)) .or. (.not. (y <= 3.5d+51))) then
tmp = x + ((z * y) + (a * t))
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.25e+47) || !(y <= 3.5e+51)) {
tmp = x + ((z * y) + (a * t));
} else {
tmp = x + (a * (t + (z * b)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -1.25e+47) or not (y <= 3.5e+51): tmp = x + ((z * y) + (a * t)) else: tmp = x + (a * (t + (z * b))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -1.25e+47) || !(y <= 3.5e+51)) tmp = Float64(x + Float64(Float64(z * y) + Float64(a * t))); 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.25e+47) || ~((y <= 3.5e+51))) tmp = x + ((z * y) + (a * t)); else tmp = x + (a * (t + (z * b))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -1.25e+47], N[Not[LessEqual[y, 3.5e+51]], $MachinePrecision]], N[(x + N[(N[(z * y), $MachinePrecision] + N[(a * t), $MachinePrecision]), $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.25 \cdot 10^{+47} \lor \neg \left(y \leq 3.5 \cdot 10^{+51}\right):\\
\;\;\;\;x + \left(z \cdot y + a \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;x + a \cdot \left(t + z \cdot b\right)\\
\end{array}
\end{array}
if y < -1.25000000000000005e47 or 3.5e51 < y Initial program 86.5%
associate-+l+86.5%
associate-*l*89.4%
Simplified89.4%
Taylor expanded in b around 0 85.9%
if -1.25000000000000005e47 < y < 3.5e51Initial program 94.7%
associate-+l+94.7%
+-commutative94.7%
fma-define94.7%
associate-*l*94.2%
*-commutative94.2%
*-commutative94.2%
distribute-rgt-out96.2%
*-commutative96.2%
Simplified96.2%
Taylor expanded in y around 0 90.0%
Final simplification88.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -2.6e+113) (not (<= z 3.6e+77))) (* 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.6e+113) || !(z <= 3.6e+77)) {
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.6d+113)) .or. (.not. (z <= 3.6d+77))) 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.6e+113) || !(z <= 3.6e+77)) {
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.6e+113) or not (z <= 3.6e+77): 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.6e+113) || !(z <= 3.6e+77)) 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.6e+113) || ~((z <= 3.6e+77))) 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.6e+113], N[Not[LessEqual[z, 3.6e+77]], $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.6 \cdot 10^{+113} \lor \neg \left(z \leq 3.6 \cdot 10^{+77}\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.5999999999999999e113 or 3.5999999999999998e77 < z Initial program 81.6%
associate-+l+81.6%
associate-*l*83.1%
Simplified83.1%
Taylor expanded in z around inf 85.3%
if -2.5999999999999999e113 < z < 3.5999999999999998e77Initial program 96.4%
associate-+l+96.4%
+-commutative96.4%
fma-define96.4%
associate-*l*97.0%
*-commutative97.0%
*-commutative97.0%
distribute-rgt-out97.5%
*-commutative97.5%
Simplified97.5%
Taylor expanded in y around 0 86.2%
Final simplification85.9%
(FPCore (x y z t a b) :precision binary64 (if (<= z -8.2e+113) (* z y) (if (<= z -3.5e-300) (* a t) (if (<= z 5.5e+76) x (* z y)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -8.2e+113) {
tmp = z * y;
} else if (z <= -3.5e-300) {
tmp = a * t;
} else if (z <= 5.5e+76) {
tmp = x;
} else {
tmp = 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 <= (-8.2d+113)) then
tmp = z * y
else if (z <= (-3.5d-300)) then
tmp = a * t
else if (z <= 5.5d+76) then
tmp = x
else
tmp = 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 <= -8.2e+113) {
tmp = z * y;
} else if (z <= -3.5e-300) {
tmp = a * t;
} else if (z <= 5.5e+76) {
tmp = x;
} else {
tmp = z * y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= -8.2e+113: tmp = z * y elif z <= -3.5e-300: tmp = a * t elif z <= 5.5e+76: tmp = x else: tmp = z * y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -8.2e+113) tmp = Float64(z * y); elseif (z <= -3.5e-300) tmp = Float64(a * t); elseif (z <= 5.5e+76) tmp = x; else tmp = Float64(z * y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= -8.2e+113) tmp = z * y; elseif (z <= -3.5e-300) tmp = a * t; elseif (z <= 5.5e+76) tmp = x; else tmp = z * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -8.2e+113], N[(z * y), $MachinePrecision], If[LessEqual[z, -3.5e-300], N[(a * t), $MachinePrecision], If[LessEqual[z, 5.5e+76], x, N[(z * y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.2 \cdot 10^{+113}:\\
\;\;\;\;z \cdot y\\
\mathbf{elif}\;z \leq -3.5 \cdot 10^{-300}:\\
\;\;\;\;a \cdot t\\
\mathbf{elif}\;z \leq 5.5 \cdot 10^{+76}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot y\\
\end{array}
\end{array}
if z < -8.19999999999999985e113 or 5.5000000000000001e76 < z Initial program 81.6%
associate-+l+81.6%
associate-*l*83.1%
Simplified83.1%
Taylor expanded in y around inf 55.4%
*-commutative55.4%
Simplified55.4%
if -8.19999999999999985e113 < z < -3.5000000000000002e-300Initial program 95.5%
associate-+l+95.5%
associate-*l*96.5%
Simplified96.5%
Taylor expanded in t around inf 42.4%
if -3.5000000000000002e-300 < z < 5.5000000000000001e76Initial program 97.5%
associate-+l+97.5%
associate-*l*97.4%
Simplified97.4%
Taylor expanded in x around inf 47.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -0.0055) (not (<= a 102000.0))) (* 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 <= -0.0055) || !(a <= 102000.0)) {
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 <= (-0.0055d0)) .or. (.not. (a <= 102000.0d0))) 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 <= -0.0055) || !(a <= 102000.0)) {
tmp = a * (t + (z * b));
} else {
tmp = x + (z * y);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a <= -0.0055) or not (a <= 102000.0): 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 <= -0.0055) || !(a <= 102000.0)) 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 <= -0.0055) || ~((a <= 102000.0))) 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, -0.0055], N[Not[LessEqual[a, 102000.0]], $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 -0.0055 \lor \neg \left(a \leq 102000\right):\\
\;\;\;\;a \cdot \left(t + z \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot y\\
\end{array}
\end{array}
if a < -0.0054999999999999997 or 102000 < a Initial program 85.5%
associate-+l+85.5%
associate-*l*92.7%
Simplified92.7%
Taylor expanded in a around inf 75.8%
if -0.0054999999999999997 < a < 102000Initial program 98.2%
associate-+l+98.2%
associate-*l*91.8%
Simplified91.8%
Taylor expanded in a around 0 80.5%
Final simplification78.0%
(FPCore (x y z t a b) :precision binary64 (if (<= a -1.2) (* (+ b (/ t z)) (* z a)) (if (<= a 1200.0) (+ x (* z y)) (* a (+ t (* z b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -1.2) {
tmp = (b + (t / z)) * (z * a);
} else if (a <= 1200.0) {
tmp = x + (z * y);
} else {
tmp = 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 (a <= (-1.2d0)) then
tmp = (b + (t / z)) * (z * a)
else if (a <= 1200.0d0) then
tmp = x + (z * y)
else
tmp = 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 (a <= -1.2) {
tmp = (b + (t / z)) * (z * a);
} else if (a <= 1200.0) {
tmp = x + (z * y);
} else {
tmp = a * (t + (z * b));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= -1.2: tmp = (b + (t / z)) * (z * a) elif a <= 1200.0: tmp = x + (z * y) else: tmp = a * (t + (z * b)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -1.2) tmp = Float64(Float64(b + Float64(t / z)) * Float64(z * a)); elseif (a <= 1200.0) tmp = Float64(x + Float64(z * y)); else tmp = 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 (a <= -1.2) tmp = (b + (t / z)) * (z * a); elseif (a <= 1200.0) tmp = x + (z * y); else tmp = a * (t + (z * b)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -1.2], N[(N[(b + N[(t / z), $MachinePrecision]), $MachinePrecision] * N[(z * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1200.0], N[(x + N[(z * y), $MachinePrecision]), $MachinePrecision], N[(a * N[(t + N[(z * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.2:\\
\;\;\;\;\left(b + \frac{t}{z}\right) \cdot \left(z \cdot a\right)\\
\mathbf{elif}\;a \leq 1200:\\
\;\;\;\;x + z \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(t + z \cdot b\right)\\
\end{array}
\end{array}
if a < -1.19999999999999996Initial program 84.6%
associate-+l+84.6%
associate-*l*91.5%
Simplified91.5%
Taylor expanded in z around inf 81.1%
+-commutative81.1%
associate-+l+81.1%
+-commutative81.1%
associate-/l*82.5%
distribute-lft-out83.9%
Simplified83.9%
Taylor expanded in a around inf 74.7%
associate-*r*77.9%
Simplified77.9%
if -1.19999999999999996 < a < 1200Initial program 98.2%
associate-+l+98.2%
associate-*l*91.8%
Simplified91.8%
Taylor expanded in a around 0 80.5%
if 1200 < a Initial program 86.5%
associate-+l+86.5%
associate-*l*93.9%
Simplified93.9%
Taylor expanded in a around inf 75.8%
Final simplification78.5%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -1.06e+114) (not (<= z 3.4e+55))) (+ 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.06e+114) || !(z <= 3.4e+55)) {
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.06d+114)) .or. (.not. (z <= 3.4d+55))) 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.06e+114) || !(z <= 3.4e+55)) {
tmp = x + (z * y);
} else {
tmp = x + (a * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -1.06e+114) or not (z <= 3.4e+55): 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.06e+114) || !(z <= 3.4e+55)) 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.06e+114) || ~((z <= 3.4e+55))) 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.06e+114], N[Not[LessEqual[z, 3.4e+55]], $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.06 \cdot 10^{+114} \lor \neg \left(z \leq 3.4 \cdot 10^{+55}\right):\\
\;\;\;\;x + z \cdot y\\
\mathbf{else}:\\
\;\;\;\;x + a \cdot t\\
\end{array}
\end{array}
if z < -1.05999999999999993e114 or 3.3999999999999998e55 < z Initial program 82.6%
associate-+l+82.6%
associate-*l*82.9%
Simplified82.9%
Taylor expanded in a around 0 64.2%
if -1.05999999999999993e114 < z < 3.3999999999999998e55Initial program 96.3%
associate-+l+96.3%
associate-*l*97.5%
Simplified97.5%
Taylor expanded in z around 0 67.7%
+-commutative67.7%
Simplified67.7%
Final simplification66.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -650000000000.0) (not (<= a 1.42e+55))) (* a t) x))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -650000000000.0) || !(a <= 1.42e+55)) {
tmp = a * t;
} 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 ((a <= (-650000000000.0d0)) .or. (.not. (a <= 1.42d+55))) then
tmp = a * t
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 ((a <= -650000000000.0) || !(a <= 1.42e+55)) {
tmp = a * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a <= -650000000000.0) or not (a <= 1.42e+55): tmp = a * t else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -650000000000.0) || !(a <= 1.42e+55)) tmp = Float64(a * t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((a <= -650000000000.0) || ~((a <= 1.42e+55))) tmp = a * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -650000000000.0], N[Not[LessEqual[a, 1.42e+55]], $MachinePrecision]], N[(a * t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -650000000000 \lor \neg \left(a \leq 1.42 \cdot 10^{+55}\right):\\
\;\;\;\;a \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -6.5e11 or 1.42000000000000005e55 < a Initial program 84.1%
associate-+l+84.1%
associate-*l*92.0%
Simplified92.0%
Taylor expanded in t around inf 43.0%
if -6.5e11 < a < 1.42000000000000005e55Initial program 98.4%
associate-+l+98.4%
associate-*l*92.5%
Simplified92.5%
Taylor expanded in x around inf 43.3%
Final simplification43.2%
(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 91.4%
associate-+l+91.4%
associate-*l*92.3%
Simplified92.3%
Taylor expanded in x around inf 26.7%
(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 2024135
(FPCore (x y z t a b)
:name "Graphics.Rasterific.CubicBezier:cachedBezierAt from Rasterific-0.6.1"
:precision binary64
:alt
(! :herbie-platform default (if (< z -11820553527347888000) (+ (* z (+ (* b a) y)) (+ x (* t a))) (if (< z 47589743188364287/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ (* (+ (* b z) t) a) (+ (* z y) x)) (+ (* z (+ (* b a) y)) (+ x (* t a))))))
(+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))