
(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)) (* b (* z a))))) (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)) + (b * (z * a));
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(b * Float64(z * a))) 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[(b * N[(z * a), $MachinePrecision]), $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) + b \cdot \left(z \cdot a\right)\\
\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 96.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.f6484.2
Applied rewrites84.2%
Final simplification95.7%
(FPCore (x y z t a b)
:precision binary64
(if (<= z -2.7e-45)
(fma z y x)
(if (<= z 2.65e-5)
(fma a t x)
(if (<= z 1.5e+229) (fma z y x) (* b (* z a))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -2.7e-45) {
tmp = fma(z, y, x);
} else if (z <= 2.65e-5) {
tmp = fma(a, t, x);
} else if (z <= 1.5e+229) {
tmp = fma(z, y, x);
} else {
tmp = b * (z * a);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -2.7e-45) tmp = fma(z, y, x); elseif (z <= 2.65e-5) tmp = fma(a, t, x); elseif (z <= 1.5e+229) tmp = fma(z, y, x); else tmp = Float64(b * Float64(z * a)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -2.7e-45], N[(z * y + x), $MachinePrecision], If[LessEqual[z, 2.65e-5], N[(a * t + x), $MachinePrecision], If[LessEqual[z, 1.5e+229], N[(z * y + x), $MachinePrecision], N[(b * N[(z * a), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.7 \cdot 10^{-45}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{elif}\;z \leq 2.65 \cdot 10^{-5}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\mathbf{elif}\;z \leq 1.5 \cdot 10^{+229}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(z \cdot a\right)\\
\end{array}
\end{array}
if z < -2.69999999999999985e-45 or 2.65e-5 < z < 1.49999999999999999e229Initial program 83.3%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6459.1
Applied rewrites59.1%
if -2.69999999999999985e-45 < z < 2.65e-5Initial program 98.1%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f6477.9
Applied rewrites77.9%
if 1.49999999999999999e229 < z Initial program 70.9%
Taylor expanded in b around inf
lower-*.f64N/A
lower-*.f6471.4
Applied rewrites71.4%
Applied rewrites77.0%
Final simplification69.1%
(FPCore (x y z t a b)
:precision binary64
(if (<= z -2.7e-45)
(fma z y x)
(if (<= z 2.65e-5)
(fma a t x)
(if (<= z 1.55e+229) (fma z y x) (* z (* a b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -2.7e-45) {
tmp = fma(z, y, x);
} else if (z <= 2.65e-5) {
tmp = fma(a, t, x);
} else if (z <= 1.55e+229) {
tmp = fma(z, y, x);
} else {
tmp = z * (a * b);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -2.7e-45) tmp = fma(z, y, x); elseif (z <= 2.65e-5) tmp = fma(a, t, x); elseif (z <= 1.55e+229) tmp = fma(z, y, x); else tmp = Float64(z * Float64(a * b)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -2.7e-45], N[(z * y + x), $MachinePrecision], If[LessEqual[z, 2.65e-5], N[(a * t + x), $MachinePrecision], If[LessEqual[z, 1.55e+229], N[(z * y + x), $MachinePrecision], N[(z * N[(a * b), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.7 \cdot 10^{-45}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{elif}\;z \leq 2.65 \cdot 10^{-5}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\mathbf{elif}\;z \leq 1.55 \cdot 10^{+229}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(a \cdot b\right)\\
\end{array}
\end{array}
if z < -2.69999999999999985e-45 or 2.65e-5 < z < 1.55000000000000007e229Initial program 83.3%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6459.1
Applied rewrites59.1%
if -2.69999999999999985e-45 < z < 2.65e-5Initial program 98.1%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f6477.9
Applied rewrites77.9%
if 1.55000000000000007e229 < z Initial program 70.9%
Taylor expanded in b around inf
lower-*.f64N/A
lower-*.f6471.4
Applied rewrites71.4%
Applied rewrites76.8%
Final simplification69.1%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (fma z (fma a b y) x))) (if (<= z -3.3e-29) t_1 (if (<= z 3.5e+103) (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 = fma(z, fma(a, b, y), x);
double tmp;
if (z <= -3.3e-29) {
tmp = t_1;
} else if (z <= 3.5e+103) {
tmp = fma(a, t, fma(z, y, x));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(z, fma(a, b, y), x) tmp = 0.0 if (z <= -3.3e-29) tmp = t_1; elseif (z <= 3.5e+103) 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] + x), $MachinePrecision]}, If[LessEqual[z, -3.3e-29], t$95$1, If[LessEqual[z, 3.5e+103], N[(a * t + N[(z * y + x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(z, \mathsf{fma}\left(a, b, y\right), x\right)\\
\mathbf{if}\;z \leq -3.3 \cdot 10^{-29}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{+103}:\\
\;\;\;\;\mathsf{fma}\left(a, t, \mathsf{fma}\left(z, y, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.30000000000000028e-29 or 3.5e103 < z Initial program 81.2%
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.3
Applied rewrites93.3%
if -3.30000000000000028e-29 < z < 3.5e103Initial program 96.2%
Taylor expanded in b around 0
Applied rewrites89.8%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* a (fma b z t)))) (if (<= a -1.3e+138) t_1 (if (<= a 1.75e+125) (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 = a * fma(b, z, t);
double tmp;
if (a <= -1.3e+138) {
tmp = t_1;
} else if (a <= 1.75e+125) {
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(a * fma(b, z, t)) tmp = 0.0 if (a <= -1.3e+138) tmp = t_1; elseif (a <= 1.75e+125) 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[(a * N[(b * z + t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -1.3e+138], t$95$1, If[LessEqual[a, 1.75e+125], N[(a * t + N[(z * y + x), $MachinePrecision]), $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.3 \cdot 10^{+138}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.75 \cdot 10^{+125}:\\
\;\;\;\;\mathsf{fma}\left(a, t, \mathsf{fma}\left(z, y, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.3e138 or 1.75000000000000006e125 < a Initial program 71.9%
Taylor expanded in a around inf
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6490.8
Applied rewrites90.8%
if -1.3e138 < a < 1.75000000000000006e125Initial program 96.6%
Taylor expanded in b around 0
Applied rewrites85.9%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* z (fma a b y)))) (if (<= z -3.3e-17) t_1 (if (<= z 2.45e+34) (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 <= -3.3e-17) {
tmp = t_1;
} else if (z <= 2.45e+34) {
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 <= -3.3e-17) tmp = t_1; elseif (z <= 2.45e+34) 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, -3.3e-17], t$95$1, If[LessEqual[z, 2.45e+34], 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 -3.3 \cdot 10^{-17}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.45 \cdot 10^{+34}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.3e-17 or 2.4500000000000001e34 < z Initial program 80.8%
Taylor expanded in z around inf
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6480.2
Applied rewrites80.2%
if -3.3e-17 < z < 2.4500000000000001e34Initial program 97.5%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f6476.1
Applied rewrites76.1%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* a (fma b z t)))) (if (<= a -2.5e-33) t_1 (if (<= a 2.1e-23) (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 <= -2.5e-33) {
tmp = t_1;
} else if (a <= 2.1e-23) {
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 <= -2.5e-33) tmp = t_1; elseif (a <= 2.1e-23) 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, -2.5e-33], t$95$1, If[LessEqual[a, 2.1e-23], 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 -2.5 \cdot 10^{-33}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 2.1 \cdot 10^{-23}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -2.50000000000000014e-33 or 2.1000000000000001e-23 < a Initial program 82.0%
Taylor expanded in a around inf
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6474.6
Applied rewrites74.6%
if -2.50000000000000014e-33 < a < 2.1000000000000001e-23Initial program 98.9%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6481.8
Applied rewrites81.8%
(FPCore (x y z t a b) :precision binary64 (if (<= t -2.3e+75) (fma a t x) (if (<= t 3.2e+88) (fma z y x) (fma a t x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -2.3e+75) {
tmp = fma(a, t, x);
} else if (t <= 3.2e+88) {
tmp = fma(z, y, x);
} else {
tmp = fma(a, t, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -2.3e+75) tmp = fma(a, t, x); elseif (t <= 3.2e+88) tmp = fma(z, y, x); else tmp = fma(a, t, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -2.3e+75], N[(a * t + x), $MachinePrecision], If[LessEqual[t, 3.2e+88], N[(z * y + x), $MachinePrecision], N[(a * t + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.3 \cdot 10^{+75}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\mathbf{elif}\;t \leq 3.2 \cdot 10^{+88}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\end{array}
\end{array}
if t < -2.2999999999999999e75 or 3.1999999999999999e88 < t Initial program 89.7%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f6473.3
Applied rewrites73.3%
if -2.2999999999999999e75 < t < 3.1999999999999999e88Initial program 89.3%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6464.2
Applied rewrites64.2%
(FPCore (x y z t a b) :precision binary64 (if (<= z -2.9e+25) (* y z) (if (<= z 7e+104) (fma a t x) (* y z))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -2.9e+25) {
tmp = y * z;
} else if (z <= 7e+104) {
tmp = fma(a, t, x);
} else {
tmp = y * z;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -2.9e+25) tmp = Float64(y * z); elseif (z <= 7e+104) tmp = fma(a, t, x); else tmp = Float64(y * z); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -2.9e+25], N[(y * z), $MachinePrecision], If[LessEqual[z, 7e+104], N[(a * t + x), $MachinePrecision], N[(y * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.9 \cdot 10^{+25}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq 7 \cdot 10^{+104}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if z < -2.8999999999999999e25 or 7.0000000000000003e104 < z Initial program 79.6%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6449.4
Applied rewrites49.4%
if -2.8999999999999999e25 < z < 7.0000000000000003e104Initial program 95.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f6471.9
Applied rewrites71.9%
Final simplification63.0%
(FPCore (x y z t a b) :precision binary64 (if (<= t -1.35e+62) (* t a) (if (<= t 1.5e+44) (* y z) (* t a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -1.35e+62) {
tmp = t * a;
} else if (t <= 1.5e+44) {
tmp = y * z;
} else {
tmp = 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 (t <= (-1.35d+62)) then
tmp = t * a
else if (t <= 1.5d+44) then
tmp = y * z
else
tmp = 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 (t <= -1.35e+62) {
tmp = t * a;
} else if (t <= 1.5e+44) {
tmp = y * z;
} else {
tmp = t * a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -1.35e+62: tmp = t * a elif t <= 1.5e+44: tmp = y * z else: tmp = t * a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -1.35e+62) tmp = Float64(t * a); elseif (t <= 1.5e+44) tmp = Float64(y * z); else tmp = Float64(t * a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -1.35e+62) tmp = t * a; elseif (t <= 1.5e+44) tmp = y * z; else tmp = t * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -1.35e+62], N[(t * a), $MachinePrecision], If[LessEqual[t, 1.5e+44], N[(y * z), $MachinePrecision], N[(t * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.35 \cdot 10^{+62}:\\
\;\;\;\;t \cdot a\\
\mathbf{elif}\;t \leq 1.5 \cdot 10^{+44}:\\
\;\;\;\;y \cdot z\\
\mathbf{else}:\\
\;\;\;\;t \cdot a\\
\end{array}
\end{array}
if t < -1.35e62 or 1.49999999999999993e44 < t Initial program 88.6%
Taylor expanded in t around inf
lower-*.f6451.3
Applied rewrites51.3%
if -1.35e62 < t < 1.49999999999999993e44Initial program 90.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6438.2
Applied rewrites38.2%
Final simplification43.6%
(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 89.4%
Taylor expanded in t around inf
lower-*.f6427.1
Applied rewrites27.1%
Final simplification27.1%
(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 2024233
(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)))