
(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)) (* t a)) (* (* z a) b)))) (if (<= t_1 INFINITY) t_1 (* a (fma b z t)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((x + (y * z)) + (t * a)) + ((z * a) * b);
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = a * fma(b, z, t);
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(x + Float64(y * z)) + Float64(t * a)) + Float64(Float64(z * a) * b)) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(a * fma(b, z, t)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision] + N[(N[(z * a), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(a * N[(b * z + t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(z \cdot a\right) \cdot b\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;a \cdot \mathsf{fma}\left(b, z, t\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b)) < +inf.0Initial program 97.6%
if +inf.0 < (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b)) Initial program 0.0%
Taylor expanded in a around inf
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6478.6
Applied rewrites78.6%
Final simplification96.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* z (fma a b y))))
(if (<= z -1.25e+173)
t_1
(if (<= z -550000000.0)
(fma z y x)
(if (<= z 1.26e+50) (fma a t x) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = z * fma(a, b, y);
double tmp;
if (z <= -1.25e+173) {
tmp = t_1;
} else if (z <= -550000000.0) {
tmp = fma(z, y, x);
} else if (z <= 1.26e+50) {
tmp = fma(a, t, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(z * fma(a, b, y)) tmp = 0.0 if (z <= -1.25e+173) tmp = t_1; elseif (z <= -550000000.0) tmp = fma(z, y, x); elseif (z <= 1.26e+50) tmp = fma(a, t, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(z * N[(a * b + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.25e+173], t$95$1, If[LessEqual[z, -550000000.0], N[(z * y + x), $MachinePrecision], If[LessEqual[z, 1.26e+50], N[(a * t + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \mathsf{fma}\left(a, b, y\right)\\
\mathbf{if}\;z \leq -1.25 \cdot 10^{+173}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -550000000:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{elif}\;z \leq 1.26 \cdot 10^{+50}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.25000000000000009e173 or 1.26000000000000001e50 < z Initial program 81.3%
Taylor expanded in z around inf
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6484.8
Applied rewrites84.8%
if -1.25000000000000009e173 < z < -5.5e8Initial program 92.4%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6481.2
Applied rewrites81.2%
if -5.5e8 < z < 1.26000000000000001e50Initial program 98.6%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f6480.7
Applied rewrites80.7%
(FPCore (x y z t a b)
:precision binary64
(if (<= z -4.7e+206)
(* (* z a) b)
(if (<= z -550000000.0)
(fma z y x)
(if (<= z 1.2e+38) (fma a t x) (fma z y x)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -4.7e+206) {
tmp = (z * a) * b;
} else if (z <= -550000000.0) {
tmp = fma(z, y, x);
} else if (z <= 1.2e+38) {
tmp = fma(a, t, x);
} else {
tmp = fma(z, y, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -4.7e+206) tmp = Float64(Float64(z * a) * b); elseif (z <= -550000000.0) tmp = fma(z, y, x); elseif (z <= 1.2e+38) tmp = fma(a, t, x); else tmp = fma(z, y, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -4.7e+206], N[(N[(z * a), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[z, -550000000.0], N[(z * y + x), $MachinePrecision], If[LessEqual[z, 1.2e+38], N[(a * t + x), $MachinePrecision], N[(z * y + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.7 \cdot 10^{+206}:\\
\;\;\;\;\left(z \cdot a\right) \cdot b\\
\mathbf{elif}\;z \leq -550000000:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{+38}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\end{array}
\end{array}
if z < -4.6999999999999998e206Initial program 86.4%
Taylor expanded in b around inf
lower-*.f64N/A
lower-*.f6468.7
Applied rewrites68.7%
Applied rewrites69.0%
if -4.6999999999999998e206 < z < -5.5e8 or 1.20000000000000009e38 < z Initial program 83.7%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6464.1
Applied rewrites64.1%
if -5.5e8 < z < 1.20000000000000009e38Initial program 98.6%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f6481.0
Applied rewrites81.0%
(FPCore (x y z t a b)
:precision binary64
(if (<= z -4.7e+206)
(* a (* z b))
(if (<= z -550000000.0)
(fma z y x)
(if (<= z 1.2e+38) (fma a t x) (fma z y x)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -4.7e+206) {
tmp = a * (z * b);
} else if (z <= -550000000.0) {
tmp = fma(z, y, x);
} else if (z <= 1.2e+38) {
tmp = fma(a, t, x);
} else {
tmp = fma(z, y, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -4.7e+206) tmp = Float64(a * Float64(z * b)); elseif (z <= -550000000.0) tmp = fma(z, y, x); elseif (z <= 1.2e+38) tmp = fma(a, t, x); else tmp = fma(z, y, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -4.7e+206], N[(a * N[(z * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -550000000.0], N[(z * y + x), $MachinePrecision], If[LessEqual[z, 1.2e+38], N[(a * t + x), $MachinePrecision], N[(z * y + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.7 \cdot 10^{+206}:\\
\;\;\;\;a \cdot \left(z \cdot b\right)\\
\mathbf{elif}\;z \leq -550000000:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{+38}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\end{array}
\end{array}
if z < -4.6999999999999998e206Initial program 86.4%
Taylor expanded in b around inf
lower-*.f64N/A
lower-*.f6468.7
Applied rewrites68.7%
if -4.6999999999999998e206 < z < -5.5e8 or 1.20000000000000009e38 < z Initial program 83.7%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6464.1
Applied rewrites64.1%
if -5.5e8 < z < 1.20000000000000009e38Initial program 98.6%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f6481.0
Applied rewrites81.0%
Final simplification74.0%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (fma a t (fma z y x)))) (if (<= t -1.46e-43) t_1 (if (<= t 0.0027) (fma z (fma a b y) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(a, t, fma(z, y, x));
double tmp;
if (t <= -1.46e-43) {
tmp = t_1;
} else if (t <= 0.0027) {
tmp = fma(z, fma(a, b, y), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(a, t, fma(z, y, x)) tmp = 0.0 if (t <= -1.46e-43) tmp = t_1; elseif (t <= 0.0027) tmp = fma(z, fma(a, b, y), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a * t + N[(z * y + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.46e-43], t$95$1, If[LessEqual[t, 0.0027], N[(z * N[(a * b + y), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, t, \mathsf{fma}\left(z, y, x\right)\right)\\
\mathbf{if}\;t \leq -1.46 \cdot 10^{-43}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 0.0027:\\
\;\;\;\;\mathsf{fma}\left(z, \mathsf{fma}\left(a, b, y\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.45999999999999997e-43 or 0.0027000000000000001 < t Initial program 92.0%
Taylor expanded in b around 0
Applied rewrites86.6%
if -1.45999999999999997e-43 < t < 0.0027000000000000001Initial program 92.6%
Taylor expanded in t around 0
+-commutativeN/A
+-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6493.6
Applied rewrites93.6%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* z (fma a b y)))) (if (<= z -3.6e+198) t_1 (if (<= z 7e+134) (fma a t (fma z y x)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = z * fma(a, b, y);
double tmp;
if (z <= -3.6e+198) {
tmp = t_1;
} else if (z <= 7e+134) {
tmp = fma(a, t, fma(z, y, x));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(z * fma(a, b, y)) tmp = 0.0 if (z <= -3.6e+198) tmp = t_1; elseif (z <= 7e+134) tmp = fma(a, t, fma(z, y, x)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(z * N[(a * b + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.6e+198], t$95$1, If[LessEqual[z, 7e+134], N[(a * t + N[(z * y + x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \mathsf{fma}\left(a, b, y\right)\\
\mathbf{if}\;z \leq -3.6 \cdot 10^{+198}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 7 \cdot 10^{+134}:\\
\;\;\;\;\mathsf{fma}\left(a, t, \mathsf{fma}\left(z, y, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.6000000000000002e198 or 7.00000000000000006e134 < z Initial program 80.7%
Taylor expanded in z around inf
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6490.1
Applied rewrites90.1%
if -3.6000000000000002e198 < z < 7.00000000000000006e134Initial program 96.3%
Taylor expanded in b around 0
Applied rewrites87.5%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* a (fma b z t)))) (if (<= a -1.04e+105) t_1 (if (<= a 2.8e+16) (fma z y x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a * fma(b, z, t);
double tmp;
if (a <= -1.04e+105) {
tmp = t_1;
} else if (a <= 2.8e+16) {
tmp = fma(z, y, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(a * fma(b, z, t)) tmp = 0.0 if (a <= -1.04e+105) tmp = t_1; elseif (a <= 2.8e+16) tmp = fma(z, y, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a * N[(b * z + t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -1.04e+105], t$95$1, If[LessEqual[a, 2.8e+16], N[(z * y + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot \mathsf{fma}\left(b, z, t\right)\\
\mathbf{if}\;a \leq -1.04 \cdot 10^{+105}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 2.8 \cdot 10^{+16}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.04e105 or 2.8e16 < a Initial program 84.6%
Taylor expanded in a around inf
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6479.9
Applied rewrites79.9%
if -1.04e105 < a < 2.8e16Initial program 98.5%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6477.3
Applied rewrites77.3%
(FPCore (x y z t a b) :precision binary64 (if (<= z -550000000.0) (fma z y x) (if (<= z 1.2e+38) (fma a t x) (fma z y x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -550000000.0) {
tmp = fma(z, y, x);
} else if (z <= 1.2e+38) {
tmp = fma(a, t, x);
} else {
tmp = fma(z, y, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -550000000.0) tmp = fma(z, y, x); elseif (z <= 1.2e+38) tmp = fma(a, t, x); else tmp = fma(z, y, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -550000000.0], N[(z * y + x), $MachinePrecision], If[LessEqual[z, 1.2e+38], N[(a * t + x), $MachinePrecision], N[(z * y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -550000000:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{+38}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\end{array}
\end{array}
if z < -5.5e8 or 1.20000000000000009e38 < z Initial program 84.2%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6460.6
Applied rewrites60.6%
if -5.5e8 < z < 1.20000000000000009e38Initial program 98.6%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f6481.0
Applied rewrites81.0%
(FPCore (x y z t a b) :precision binary64 (if (<= z -7.5e+28) (* y z) (if (<= z 1.36e+52) (fma a t x) (* y z))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -7.5e+28) {
tmp = y * z;
} else if (z <= 1.36e+52) {
tmp = fma(a, t, x);
} else {
tmp = y * z;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -7.5e+28) tmp = Float64(y * z); elseif (z <= 1.36e+52) tmp = fma(a, t, x); else tmp = Float64(y * z); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -7.5e+28], N[(y * z), $MachinePrecision], If[LessEqual[z, 1.36e+52], N[(a * t + x), $MachinePrecision], N[(y * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{+28}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq 1.36 \cdot 10^{+52}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if z < -7.4999999999999998e28 or 1.35999999999999994e52 < z Initial program 83.3%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6450.4
Applied rewrites50.4%
if -7.4999999999999998e28 < z < 1.35999999999999994e52Initial program 98.6%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f6479.9
Applied rewrites79.9%
Final simplification67.7%
(FPCore (x y z t a b) :precision binary64 (if (<= z -0.095) (* y z) (if (<= z 1.2e+38) (* t a) (* y z))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -0.095) {
tmp = y * z;
} else if (z <= 1.2e+38) {
tmp = t * a;
} else {
tmp = 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 (z <= (-0.095d0)) then
tmp = y * z
else if (z <= 1.2d+38) then
tmp = t * a
else
tmp = 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 (z <= -0.095) {
tmp = y * z;
} else if (z <= 1.2e+38) {
tmp = t * a;
} else {
tmp = y * z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= -0.095: tmp = y * z elif z <= 1.2e+38: tmp = t * a else: tmp = y * z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -0.095) tmp = Float64(y * z); elseif (z <= 1.2e+38) tmp = Float64(t * a); else tmp = Float64(y * z); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= -0.095) tmp = y * z; elseif (z <= 1.2e+38) tmp = t * a; else tmp = y * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -0.095], N[(y * z), $MachinePrecision], If[LessEqual[z, 1.2e+38], N[(t * a), $MachinePrecision], N[(y * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.095:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{+38}:\\
\;\;\;\;t \cdot a\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if z < -0.095000000000000001 or 1.20000000000000009e38 < z Initial program 84.3%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6448.5
Applied rewrites48.5%
if -0.095000000000000001 < z < 1.20000000000000009e38Initial program 98.6%
Taylor expanded in t around inf
lower-*.f6443.1
Applied rewrites43.1%
Final simplification45.5%
(FPCore (x y z t a b) :precision binary64 (* t a))
double code(double x, double y, double z, double t, double a, double b) {
return t * a;
}
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 = t * a
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return t * a;
}
def code(x, y, z, t, a, b): return t * a
function code(x, y, z, t, a, b) return Float64(t * a) end
function tmp = code(x, y, z, t, a, b) tmp = t * a; end
code[x_, y_, z_, t_, a_, b_] := N[(t * a), $MachinePrecision]
\begin{array}{l}
\\
t \cdot a
\end{array}
Initial program 92.3%
Taylor expanded in t around inf
lower-*.f6430.3
Applied rewrites30.3%
Final simplification30.3%
(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 2024219
(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)))