
(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 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x + (y * z)) + (t * a)) + ((a * z) * b);
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((x + (y * z)) + (t * a)) + ((a * z) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x + (y * z)) + (t * a)) + ((a * z) * b);
}
def code(x, y, z, t, a, b): return ((x + (y * z)) + (t * a)) + ((a * z) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x + Float64(y * z)) + Float64(t * a)) + Float64(Float64(a * z) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x + (y * z)) + (t * a)) + ((a * z) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision] + N[(N[(a * z), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b
\end{array}
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ x (* y z))))
(if (<= (+ (+ t_1 (* t a)) (* (* z a) b)) INFINITY)
(+ t_1 (+ (* a (* z b)) (* t a)))
(* y (+ (* a (+ (/ t y) (* z (/ b y)))) (+ z (/ x y)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + (y * z);
double tmp;
if (((t_1 + (t * a)) + ((z * a) * b)) <= ((double) INFINITY)) {
tmp = t_1 + ((a * (z * b)) + (t * a));
} else {
tmp = y * ((a * ((t / y) + (z * (b / y)))) + (z + (x / y)));
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + (y * z);
double tmp;
if (((t_1 + (t * a)) + ((z * a) * b)) <= Double.POSITIVE_INFINITY) {
tmp = t_1 + ((a * (z * b)) + (t * a));
} else {
tmp = y * ((a * ((t / y) + (z * (b / y)))) + (z + (x / y)));
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x + (y * z) tmp = 0 if ((t_1 + (t * a)) + ((z * a) * b)) <= math.inf: tmp = t_1 + ((a * (z * b)) + (t * a)) else: tmp = y * ((a * ((t / y) + (z * (b / y)))) + (z + (x / y))) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x + Float64(y * z)) tmp = 0.0 if (Float64(Float64(t_1 + Float64(t * a)) + Float64(Float64(z * a) * b)) <= Inf) tmp = Float64(t_1 + Float64(Float64(a * Float64(z * b)) + Float64(t * a))); else tmp = Float64(y * Float64(Float64(a * Float64(Float64(t / y) + Float64(z * Float64(b / y)))) + Float64(z + Float64(x / y)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x + (y * z); tmp = 0.0; if (((t_1 + (t * a)) + ((z * a) * b)) <= Inf) tmp = t_1 + ((a * (z * b)) + (t * a)); else tmp = y * ((a * ((t / y) + (z * (b / y)))) + (z + (x / y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(t$95$1 + N[(t * a), $MachinePrecision]), $MachinePrecision] + N[(N[(z * a), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], Infinity], N[(t$95$1 + N[(N[(a * N[(z * b), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(a * N[(N[(t / y), $MachinePrecision] + N[(z * N[(b / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(z + N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + y \cdot z\\
\mathbf{if}\;\left(t\_1 + t \cdot a\right) + \left(z \cdot a\right) \cdot b \leq \infty:\\
\;\;\;\;t\_1 + \left(a \cdot \left(z \cdot b\right) + t \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(a \cdot \left(\frac{t}{y} + z \cdot \frac{b}{y}\right) + \left(z + \frac{x}{y}\right)\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b)) < +inf.0Initial program 96.8%
associate-+l+96.8%
associate-*l*97.2%
Simplified97.2%
if +inf.0 < (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b)) Initial program 0.0%
associate-+l+0.0%
associate-*l*21.4%
Simplified21.4%
Taylor expanded in y around inf 35.7%
+-commutative35.7%
+-commutative35.7%
associate-+l+35.7%
associate-/l*50.0%
associate-/l*71.4%
distribute-lft-out85.7%
*-commutative85.7%
associate-/l*92.9%
+-commutative92.9%
Simplified92.9%
Final simplification97.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ x (* y z))))
(if (<= (+ (+ t_1 (* t a)) (* (* z a) b)) INFINITY)
(+ t_1 (+ (* a (* z b)) (* t a)))
(+ x (* z (* a (+ b (/ t z))))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + (y * z);
double tmp;
if (((t_1 + (t * a)) + ((z * a) * b)) <= ((double) INFINITY)) {
tmp = t_1 + ((a * (z * b)) + (t * a));
} else {
tmp = x + (z * (a * (b + (t / z))));
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + (y * z);
double tmp;
if (((t_1 + (t * a)) + ((z * a) * b)) <= Double.POSITIVE_INFINITY) {
tmp = t_1 + ((a * (z * b)) + (t * a));
} else {
tmp = x + (z * (a * (b + (t / z))));
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x + (y * z) tmp = 0 if ((t_1 + (t * a)) + ((z * a) * b)) <= math.inf: tmp = t_1 + ((a * (z * b)) + (t * a)) else: tmp = x + (z * (a * (b + (t / z)))) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x + Float64(y * z)) tmp = 0.0 if (Float64(Float64(t_1 + Float64(t * a)) + Float64(Float64(z * a) * b)) <= Inf) tmp = Float64(t_1 + Float64(Float64(a * Float64(z * b)) + Float64(t * a))); else tmp = Float64(x + Float64(z * Float64(a * Float64(b + Float64(t / z))))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x + (y * z); tmp = 0.0; if (((t_1 + (t * a)) + ((z * a) * b)) <= Inf) tmp = t_1 + ((a * (z * b)) + (t * a)); else tmp = x + (z * (a * (b + (t / z)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(t$95$1 + N[(t * a), $MachinePrecision]), $MachinePrecision] + N[(N[(z * a), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], Infinity], N[(t$95$1 + N[(N[(a * N[(z * b), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(a * N[(b + N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + y \cdot z\\
\mathbf{if}\;\left(t\_1 + t \cdot a\right) + \left(z \cdot a\right) \cdot b \leq \infty:\\
\;\;\;\;t\_1 + \left(a \cdot \left(z \cdot b\right) + t \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(a \cdot \left(b + \frac{t}{z}\right)\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b)) < +inf.0Initial program 96.8%
associate-+l+96.8%
associate-*l*97.2%
Simplified97.2%
if +inf.0 < (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b)) Initial program 0.0%
associate-+l+0.0%
associate-*l*21.4%
Simplified21.4%
add-cube-cbrt21.4%
pow321.4%
Applied egg-rr21.4%
Taylor expanded in z around inf 42.9%
+-commutative42.9%
associate-/l*57.1%
distribute-lft-out57.1%
Simplified57.1%
Taylor expanded in y around 0 85.7%
associate-*r*85.7%
*-commutative85.7%
+-commutative85.7%
associate-*r*85.7%
+-commutative85.7%
Simplified85.7%
Final simplification96.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -7e-127) (not (<= z 7.5e-155))) (+ (+ x (* y z)) (* z (* a (+ b (/ t z))))) (+ x (+ (* y z) (* t a)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -7e-127) || !(z <= 7.5e-155)) {
tmp = (x + (y * z)) + (z * (a * (b + (t / z))));
} else {
tmp = x + ((y * z) + (t * a));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((z <= (-7d-127)) .or. (.not. (z <= 7.5d-155))) then
tmp = (x + (y * z)) + (z * (a * (b + (t / z))))
else
tmp = x + ((y * z) + (t * a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -7e-127) || !(z <= 7.5e-155)) {
tmp = (x + (y * z)) + (z * (a * (b + (t / z))));
} else {
tmp = x + ((y * z) + (t * a));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -7e-127) or not (z <= 7.5e-155): tmp = (x + (y * z)) + (z * (a * (b + (t / z)))) else: tmp = x + ((y * z) + (t * a)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -7e-127) || !(z <= 7.5e-155)) tmp = Float64(Float64(x + Float64(y * z)) + Float64(z * Float64(a * Float64(b + Float64(t / z))))); else tmp = Float64(x + Float64(Float64(y * z) + Float64(t * a))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -7e-127) || ~((z <= 7.5e-155))) tmp = (x + (y * z)) + (z * (a * (b + (t / z)))); else tmp = x + ((y * z) + (t * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -7e-127], N[Not[LessEqual[z, 7.5e-155]], $MachinePrecision]], N[(N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(z * N[(a * N[(b + N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * z), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7 \cdot 10^{-127} \lor \neg \left(z \leq 7.5 \cdot 10^{-155}\right):\\
\;\;\;\;\left(x + y \cdot z\right) + z \cdot \left(a \cdot \left(b + \frac{t}{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(y \cdot z + t \cdot a\right)\\
\end{array}
\end{array}
if z < -6.99999999999999979e-127 or 7.5000000000000006e-155 < z Initial program 88.1%
associate-+l+88.1%
associate-*l*90.3%
Simplified90.3%
Taylor expanded in z around inf 95.0%
associate-/l*95.1%
distribute-lft-out95.1%
Simplified95.1%
if -6.99999999999999979e-127 < z < 7.5000000000000006e-155Initial program 100.0%
associate-+l+100.0%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in b around 0 93.4%
Final simplification94.6%
(FPCore (x y z t a b) :precision binary64 (if (<= z -8e+230) (* z (* a b)) (if (or (<= z -2.8e-38) (not (<= z 4.8e-67))) (+ x (* y z)) (+ x (* t a)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -8e+230) {
tmp = z * (a * b);
} else if ((z <= -2.8e-38) || !(z <= 4.8e-67)) {
tmp = x + (y * z);
} else {
tmp = x + (t * a);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (z <= (-8d+230)) then
tmp = z * (a * b)
else if ((z <= (-2.8d-38)) .or. (.not. (z <= 4.8d-67))) then
tmp = x + (y * z)
else
tmp = x + (t * a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -8e+230) {
tmp = z * (a * b);
} else if ((z <= -2.8e-38) || !(z <= 4.8e-67)) {
tmp = x + (y * z);
} else {
tmp = x + (t * a);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= -8e+230: tmp = z * (a * b) elif (z <= -2.8e-38) or not (z <= 4.8e-67): tmp = x + (y * z) else: tmp = x + (t * a) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -8e+230) tmp = Float64(z * Float64(a * b)); elseif ((z <= -2.8e-38) || !(z <= 4.8e-67)) tmp = Float64(x + Float64(y * z)); else tmp = Float64(x + Float64(t * a)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= -8e+230) tmp = z * (a * b); elseif ((z <= -2.8e-38) || ~((z <= 4.8e-67))) tmp = x + (y * z); else tmp = x + (t * a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -8e+230], N[(z * N[(a * b), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -2.8e-38], N[Not[LessEqual[z, 4.8e-67]], $MachinePrecision]], N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8 \cdot 10^{+230}:\\
\;\;\;\;z \cdot \left(a \cdot b\right)\\
\mathbf{elif}\;z \leq -2.8 \cdot 10^{-38} \lor \neg \left(z \leq 4.8 \cdot 10^{-67}\right):\\
\;\;\;\;x + y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot a\\
\end{array}
\end{array}
if z < -8.0000000000000008e230Initial program 66.5%
associate-+l+66.5%
associate-*l*86.5%
Simplified86.5%
Taylor expanded in z around inf 92.8%
Taylor expanded in y around 0 78.8%
*-commutative78.8%
Simplified78.8%
if -8.0000000000000008e230 < z < -2.8e-38 or 4.8e-67 < z Initial program 87.2%
associate-+l+87.2%
associate-*l*88.2%
Simplified88.2%
Taylor expanded in a around 0 55.7%
if -2.8e-38 < z < 4.8e-67Initial program 100.0%
associate-+l+100.0%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in z around 0 81.5%
+-commutative81.5%
Simplified81.5%
Final simplification68.0%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -2.4e-28) (not (<= z 2.8e+50))) (+ x (* z (+ y (* a b)))) (+ x (+ (* y z) (* t a)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -2.4e-28) || !(z <= 2.8e+50)) {
tmp = x + (z * (y + (a * b)));
} else {
tmp = x + ((y * z) + (t * a));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((z <= (-2.4d-28)) .or. (.not. (z <= 2.8d+50))) then
tmp = x + (z * (y + (a * b)))
else
tmp = x + ((y * z) + (t * a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -2.4e-28) || !(z <= 2.8e+50)) {
tmp = x + (z * (y + (a * b)));
} else {
tmp = x + ((y * z) + (t * a));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -2.4e-28) or not (z <= 2.8e+50): tmp = x + (z * (y + (a * b))) else: tmp = x + ((y * z) + (t * a)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -2.4e-28) || !(z <= 2.8e+50)) tmp = Float64(x + Float64(z * Float64(y + Float64(a * b)))); else tmp = Float64(x + Float64(Float64(y * z) + Float64(t * a))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -2.4e-28) || ~((z <= 2.8e+50))) tmp = x + (z * (y + (a * b))); else tmp = x + ((y * z) + (t * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -2.4e-28], N[Not[LessEqual[z, 2.8e+50]], $MachinePrecision]], N[(x + N[(z * N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * z), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.4 \cdot 10^{-28} \lor \neg \left(z \leq 2.8 \cdot 10^{+50}\right):\\
\;\;\;\;x + z \cdot \left(y + a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(y \cdot z + t \cdot a\right)\\
\end{array}
\end{array}
if z < -2.4000000000000002e-28 or 2.7999999999999998e50 < z Initial program 82.1%
associate-+l+82.1%
associate-*l*85.4%
Simplified85.4%
Taylor expanded in t around 0 77.1%
+-commutative77.1%
+-commutative77.1%
associate-*r*82.5%
distribute-rgt-in88.3%
Simplified88.3%
if -2.4000000000000002e-28 < z < 2.7999999999999998e50Initial program 100.0%
associate-+l+100.0%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in b around 0 90.4%
Final simplification89.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -5.4e+38) (not (<= z 9.5e+74))) (* z (+ y (* a b))) (+ x (+ (* y z) (* t a)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -5.4e+38) || !(z <= 9.5e+74)) {
tmp = z * (y + (a * b));
} else {
tmp = x + ((y * z) + (t * a));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((z <= (-5.4d+38)) .or. (.not. (z <= 9.5d+74))) then
tmp = z * (y + (a * b))
else
tmp = x + ((y * z) + (t * a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -5.4e+38) || !(z <= 9.5e+74)) {
tmp = z * (y + (a * b));
} else {
tmp = x + ((y * z) + (t * a));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -5.4e+38) or not (z <= 9.5e+74): tmp = z * (y + (a * b)) else: tmp = x + ((y * z) + (t * a)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -5.4e+38) || !(z <= 9.5e+74)) tmp = Float64(z * Float64(y + Float64(a * b))); else tmp = Float64(x + Float64(Float64(y * z) + Float64(t * a))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -5.4e+38) || ~((z <= 9.5e+74))) tmp = z * (y + (a * b)); else tmp = x + ((y * z) + (t * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -5.4e+38], N[Not[LessEqual[z, 9.5e+74]], $MachinePrecision]], N[(z * N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * z), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.4 \cdot 10^{+38} \lor \neg \left(z \leq 9.5 \cdot 10^{+74}\right):\\
\;\;\;\;z \cdot \left(y + a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(y \cdot z + t \cdot a\right)\\
\end{array}
\end{array}
if z < -5.39999999999999992e38 or 9.5000000000000006e74 < z Initial program 77.9%
associate-+l+77.9%
associate-*l*82.0%
Simplified82.0%
Taylor expanded in z around inf 81.1%
if -5.39999999999999992e38 < z < 9.5000000000000006e74Initial program 100.0%
associate-+l+100.0%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in b around 0 88.0%
Final simplification85.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -4.8e-48) (not (<= z 1.6e+14))) (* z (+ y (* a b))) (+ x (* t a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -4.8e-48) || !(z <= 1.6e+14)) {
tmp = z * (y + (a * b));
} else {
tmp = x + (t * a);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((z <= (-4.8d-48)) .or. (.not. (z <= 1.6d+14))) then
tmp = z * (y + (a * b))
else
tmp = x + (t * a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -4.8e-48) || !(z <= 1.6e+14)) {
tmp = z * (y + (a * b));
} else {
tmp = x + (t * a);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -4.8e-48) or not (z <= 1.6e+14): tmp = z * (y + (a * b)) else: tmp = x + (t * a) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -4.8e-48) || !(z <= 1.6e+14)) tmp = Float64(z * Float64(y + Float64(a * b))); else tmp = Float64(x + Float64(t * a)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -4.8e-48) || ~((z <= 1.6e+14))) tmp = z * (y + (a * b)); else tmp = x + (t * a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -4.8e-48], N[Not[LessEqual[z, 1.6e+14]], $MachinePrecision]], N[(z * N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.8 \cdot 10^{-48} \lor \neg \left(z \leq 1.6 \cdot 10^{+14}\right):\\
\;\;\;\;z \cdot \left(y + a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot a\\
\end{array}
\end{array}
if z < -4.8e-48 or 1.6e14 < z Initial program 84.0%
associate-+l+84.0%
associate-*l*87.0%
Simplified87.0%
Taylor expanded in z around inf 74.4%
if -4.8e-48 < z < 1.6e14Initial program 99.9%
associate-+l+99.9%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in z around 0 79.3%
+-commutative79.3%
Simplified79.3%
Final simplification76.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -6.5e-18) (not (<= a 4.6e+107))) (* a (+ t (* z b))) (+ x (* y z))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -6.5e-18) || !(a <= 4.6e+107)) {
tmp = a * (t + (z * b));
} else {
tmp = x + (y * 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 <= (-6.5d-18)) .or. (.not. (a <= 4.6d+107))) then
tmp = a * (t + (z * b))
else
tmp = x + (y * 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 <= -6.5e-18) || !(a <= 4.6e+107)) {
tmp = a * (t + (z * b));
} else {
tmp = x + (y * z);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a <= -6.5e-18) or not (a <= 4.6e+107): tmp = a * (t + (z * b)) else: tmp = x + (y * z) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -6.5e-18) || !(a <= 4.6e+107)) tmp = Float64(a * Float64(t + Float64(z * b))); else tmp = Float64(x + Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((a <= -6.5e-18) || ~((a <= 4.6e+107))) tmp = a * (t + (z * b)); else tmp = x + (y * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -6.5e-18], N[Not[LessEqual[a, 4.6e+107]], $MachinePrecision]], N[(a * N[(t + N[(z * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -6.5 \cdot 10^{-18} \lor \neg \left(a \leq 4.6 \cdot 10^{+107}\right):\\
\;\;\;\;a \cdot \left(t + z \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot z\\
\end{array}
\end{array}
if a < -6.50000000000000008e-18 or 4.6000000000000001e107 < a Initial program 83.5%
associate-+l+83.5%
associate-*l*92.0%
Simplified92.0%
Taylor expanded in a around inf 80.7%
if -6.50000000000000008e-18 < a < 4.6000000000000001e107Initial program 97.9%
associate-+l+97.9%
associate-*l*94.0%
Simplified94.0%
Taylor expanded in a around 0 71.3%
Final simplification75.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -4e+30) (not (<= t 6e+164))) (* t a) (+ x (* y z))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -4e+30) || !(t <= 6e+164)) {
tmp = t * a;
} else {
tmp = x + (y * 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 ((t <= (-4d+30)) .or. (.not. (t <= 6d+164))) then
tmp = t * a
else
tmp = x + (y * 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 ((t <= -4e+30) || !(t <= 6e+164)) {
tmp = t * a;
} else {
tmp = x + (y * z);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (t <= -4e+30) or not (t <= 6e+164): tmp = t * a else: tmp = x + (y * z) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -4e+30) || !(t <= 6e+164)) tmp = Float64(t * a); else tmp = Float64(x + Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((t <= -4e+30) || ~((t <= 6e+164))) tmp = t * a; else tmp = x + (y * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -4e+30], N[Not[LessEqual[t, 6e+164]], $MachinePrecision]], N[(t * a), $MachinePrecision], N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4 \cdot 10^{+30} \lor \neg \left(t \leq 6 \cdot 10^{+164}\right):\\
\;\;\;\;t \cdot a\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot z\\
\end{array}
\end{array}
if t < -4.0000000000000001e30 or 6.00000000000000001e164 < t Initial program 88.5%
associate-+l+88.5%
associate-*l*87.6%
Simplified87.6%
Taylor expanded in t around inf 62.9%
if -4.0000000000000001e30 < t < 6.00000000000000001e164Initial program 93.1%
associate-+l+93.1%
associate-*l*95.9%
Simplified95.9%
Taylor expanded in a around 0 62.6%
Final simplification62.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -1.1e+30) (not (<= t 2.62e+36))) (* t a) x))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -1.1e+30) || !(t <= 2.62e+36)) {
tmp = t * a;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((t <= (-1.1d+30)) .or. (.not. (t <= 2.62d+36))) then
tmp = t * a
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -1.1e+30) || !(t <= 2.62e+36)) {
tmp = t * a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (t <= -1.1e+30) or not (t <= 2.62e+36): tmp = t * a else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -1.1e+30) || !(t <= 2.62e+36)) tmp = Float64(t * a); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((t <= -1.1e+30) || ~((t <= 2.62e+36))) tmp = t * a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -1.1e+30], N[Not[LessEqual[t, 2.62e+36]], $MachinePrecision]], N[(t * a), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.1 \cdot 10^{+30} \lor \neg \left(t \leq 2.62 \cdot 10^{+36}\right):\\
\;\;\;\;t \cdot a\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -1.1e30 or 2.6200000000000001e36 < t Initial program 91.1%
associate-+l+91.1%
associate-*l*90.4%
Simplified90.4%
Taylor expanded in t around inf 57.2%
if -1.1e30 < t < 2.6200000000000001e36Initial program 91.8%
associate-+l+91.8%
associate-*l*95.2%
Simplified95.2%
Taylor expanded in x around inf 37.5%
Final simplification46.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.5%
associate-+l+91.5%
associate-*l*93.1%
Simplified93.1%
Taylor expanded in x around inf 24.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 2024123
(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)))