
(FPCore (x y z t a b c) :precision binary64 (+ (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0)) c))
double code(double x, double y, double z, double t, double a, double b, double c) {
return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c;
}
real(8) function code(x, y, z, t, a, b, c)
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), intent (in) :: c
code = (((x * y) + ((z * t) / 16.0d0)) - ((a * b) / 4.0d0)) + c
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c;
}
def code(x, y, z, t, a, b, c): return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c
function code(x, y, z, t, a, b, c) return Float64(Float64(Float64(Float64(x * y) + Float64(Float64(z * t) / 16.0)) - Float64(Float64(a * b) / 4.0)) + c) end
function tmp = code(x, y, z, t, a, b, c) tmp = (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c; end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision] + c), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b c) :precision binary64 (+ (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0)) c))
double code(double x, double y, double z, double t, double a, double b, double c) {
return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c;
}
real(8) function code(x, y, z, t, a, b, c)
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), intent (in) :: c
code = (((x * y) + ((z * t) / 16.0d0)) - ((a * b) / 4.0d0)) + c
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c;
}
def code(x, y, z, t, a, b, c): return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c
function code(x, y, z, t, a, b, c) return Float64(Float64(Float64(Float64(x * y) + Float64(Float64(z * t) / 16.0)) - Float64(Float64(a * b) / 4.0)) + c) end
function tmp = code(x, y, z, t, a, b, c) tmp = (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c; end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision] + c), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c
\end{array}
(FPCore (x y z t a b c) :precision binary64 (+ (fma (* t 0.0625) z (fma y x (* (* b a) -0.25))) c))
double code(double x, double y, double z, double t, double a, double b, double c) {
return fma((t * 0.0625), z, fma(y, x, ((b * a) * -0.25))) + c;
}
function code(x, y, z, t, a, b, c) return Float64(fma(Float64(t * 0.0625), z, fma(y, x, Float64(Float64(b * a) * -0.25))) + c) end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(t * 0.0625), $MachinePrecision] * z + N[(y * x + N[(N[(b * a), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + c), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(t \cdot 0.0625, z, \mathsf{fma}\left(y, x, \left(b \cdot a\right) \cdot -0.25\right)\right) + c
\end{array}
Initial program 96.9%
lift--.f64N/A
sub-negN/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
div-invN/A
lower-*.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
div-invN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
Applied rewrites98.4%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (+ (* x y) (/ (* z t) 16.0))))
(if (or (<= t_1 -2e+198) (not (<= t_1 1e+149)))
(fma y x (* (* t z) 0.0625))
(fma -0.25 (* a b) c))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (x * y) + ((z * t) / 16.0);
double tmp;
if ((t_1 <= -2e+198) || !(t_1 <= 1e+149)) {
tmp = fma(y, x, ((t * z) * 0.0625));
} else {
tmp = fma(-0.25, (a * b), c);
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(x * y) + Float64(Float64(z * t) / 16.0)) tmp = 0.0 if ((t_1 <= -2e+198) || !(t_1 <= 1e+149)) tmp = fma(y, x, Float64(Float64(t * z) * 0.0625)); else tmp = fma(-0.25, Float64(a * b), c); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -2e+198], N[Not[LessEqual[t$95$1, 1e+149]], $MachinePrecision]], N[(y * x + N[(N[(t * z), $MachinePrecision] * 0.0625), $MachinePrecision]), $MachinePrecision], N[(-0.25 * N[(a * b), $MachinePrecision] + c), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot y + \frac{z \cdot t}{16}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+198} \lor \neg \left(t\_1 \leq 10^{+149}\right):\\
\;\;\;\;\mathsf{fma}\left(y, x, \left(t \cdot z\right) \cdot 0.0625\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.25, a \cdot b, c\right)\\
\end{array}
\end{array}
if (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) < -2.00000000000000004e198 or 1.00000000000000005e149 < (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) Initial program 93.5%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6490.6
Applied rewrites90.6%
Taylor expanded in x around 0
Applied rewrites54.7%
Taylor expanded in c around 0
Applied rewrites84.9%
Applied rewrites86.5%
if -2.00000000000000004e198 < (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) < 1.00000000000000005e149Initial program 100.0%
Taylor expanded in z around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6491.9
Applied rewrites91.9%
Taylor expanded in x around 0
Applied rewrites78.2%
Final simplification82.2%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (+ (* x y) (/ (* z t) 16.0))))
(if (<= t_1 -2e+198)
(fma y x (* (* t z) 0.0625))
(if (<= t_1 1e+149) (fma -0.25 (* a b) c) (fma (* 0.0625 z) t (* y x))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (x * y) + ((z * t) / 16.0);
double tmp;
if (t_1 <= -2e+198) {
tmp = fma(y, x, ((t * z) * 0.0625));
} else if (t_1 <= 1e+149) {
tmp = fma(-0.25, (a * b), c);
} else {
tmp = fma((0.0625 * z), t, (y * x));
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(x * y) + Float64(Float64(z * t) / 16.0)) tmp = 0.0 if (t_1 <= -2e+198) tmp = fma(y, x, Float64(Float64(t * z) * 0.0625)); elseif (t_1 <= 1e+149) tmp = fma(-0.25, Float64(a * b), c); else tmp = fma(Float64(0.0625 * z), t, Float64(y * x)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+198], N[(y * x + N[(N[(t * z), $MachinePrecision] * 0.0625), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+149], N[(-0.25 * N[(a * b), $MachinePrecision] + c), $MachinePrecision], N[(N[(0.0625 * z), $MachinePrecision] * t + N[(y * x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot y + \frac{z \cdot t}{16}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+198}:\\
\;\;\;\;\mathsf{fma}\left(y, x, \left(t \cdot z\right) \cdot 0.0625\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+149}:\\
\;\;\;\;\mathsf{fma}\left(-0.25, a \cdot b, c\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(0.0625 \cdot z, t, y \cdot x\right)\\
\end{array}
\end{array}
if (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) < -2.00000000000000004e198Initial program 96.2%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6494.5
Applied rewrites94.5%
Taylor expanded in x around 0
Applied rewrites58.1%
Taylor expanded in c around 0
Applied rewrites92.8%
Applied rewrites92.8%
if -2.00000000000000004e198 < (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) < 1.00000000000000005e149Initial program 100.0%
Taylor expanded in z around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6491.9
Applied rewrites91.9%
Taylor expanded in x around 0
Applied rewrites78.2%
if 1.00000000000000005e149 < (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) Initial program 91.5%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6487.7
Applied rewrites87.7%
Taylor expanded in x around 0
Applied rewrites52.1%
Taylor expanded in c around 0
Applied rewrites78.9%
Applied rewrites83.1%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* z t) 0.0625)))
(if (<= (* z t) -4.8e+195)
t_1
(if (<= (* z t) -2.25e-139)
(fma -0.25 (* a b) c)
(if (<= (* z t) 1.2e+143) (fma y x c) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (z * t) * 0.0625;
double tmp;
if ((z * t) <= -4.8e+195) {
tmp = t_1;
} else if ((z * t) <= -2.25e-139) {
tmp = fma(-0.25, (a * b), c);
} else if ((z * t) <= 1.2e+143) {
tmp = fma(y, x, c);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(z * t) * 0.0625) tmp = 0.0 if (Float64(z * t) <= -4.8e+195) tmp = t_1; elseif (Float64(z * t) <= -2.25e-139) tmp = fma(-0.25, Float64(a * b), c); elseif (Float64(z * t) <= 1.2e+143) tmp = fma(y, x, c); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(z * t), $MachinePrecision] * 0.0625), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -4.8e+195], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], -2.25e-139], N[(-0.25 * N[(a * b), $MachinePrecision] + c), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1.2e+143], N[(y * x + c), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(z \cdot t\right) \cdot 0.0625\\
\mathbf{if}\;z \cdot t \leq -4.8 \cdot 10^{+195}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq -2.25 \cdot 10^{-139}:\\
\;\;\;\;\mathsf{fma}\left(-0.25, a \cdot b, c\right)\\
\mathbf{elif}\;z \cdot t \leq 1.2 \cdot 10^{+143}:\\
\;\;\;\;\mathsf{fma}\left(y, x, c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -4.8000000000000005e195 or 1.1999999999999999e143 < (*.f64 z t) Initial program 92.8%
lift--.f64N/A
sub-negN/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
div-invN/A
lower-*.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
div-invN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
Applied rewrites96.4%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6476.0
Applied rewrites76.0%
if -4.8000000000000005e195 < (*.f64 z t) < -2.25000000000000011e-139Initial program 96.0%
Taylor expanded in z around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6488.3
Applied rewrites88.3%
Taylor expanded in x around 0
Applied rewrites72.9%
if -2.25000000000000011e-139 < (*.f64 z t) < 1.1999999999999999e143Initial program 100.0%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6470.9
Applied rewrites70.9%
Taylor expanded in x around 0
Applied rewrites35.3%
Taylor expanded in z around 0
Applied rewrites66.1%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= (* z t) -2e+199) (not (<= (* z t) 1e+57))) (fma y x (fma (* t z) 0.0625 c)) (fma -0.25 (* b a) (fma y x c))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (((z * t) <= -2e+199) || !((z * t) <= 1e+57)) {
tmp = fma(y, x, fma((t * z), 0.0625, c));
} else {
tmp = fma(-0.25, (b * a), fma(y, x, c));
}
return tmp;
}
function code(x, y, z, t, a, b, c) tmp = 0.0 if ((Float64(z * t) <= -2e+199) || !(Float64(z * t) <= 1e+57)) tmp = fma(y, x, fma(Float64(t * z), 0.0625, c)); else tmp = fma(-0.25, Float64(b * a), fma(y, x, c)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[N[(z * t), $MachinePrecision], -2e+199], N[Not[LessEqual[N[(z * t), $MachinePrecision], 1e+57]], $MachinePrecision]], N[(y * x + N[(N[(t * z), $MachinePrecision] * 0.0625 + c), $MachinePrecision]), $MachinePrecision], N[(-0.25 * N[(b * a), $MachinePrecision] + N[(y * x + c), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+199} \lor \neg \left(z \cdot t \leq 10^{+57}\right):\\
\;\;\;\;\mathsf{fma}\left(y, x, \mathsf{fma}\left(t \cdot z, 0.0625, c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.25, b \cdot a, \mathsf{fma}\left(y, x, c\right)\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -2.00000000000000019e199 or 1.00000000000000005e57 < (*.f64 z t) Initial program 93.4%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6490.1
Applied rewrites90.1%
if -2.00000000000000019e199 < (*.f64 z t) < 1.00000000000000005e57Initial program 98.8%
Taylor expanded in z around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6494.5
Applied rewrites94.5%
Final simplification92.9%
(FPCore (x y z t a b c)
:precision binary64
(if (<= (* z t) -2e+199)
(fma y x (fma (* t z) 0.0625 c))
(if (<= (* z t) 1e+57)
(fma -0.25 (* b a) (fma y x c))
(fma (* z 0.0625) t (fma x y c)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((z * t) <= -2e+199) {
tmp = fma(y, x, fma((t * z), 0.0625, c));
} else if ((z * t) <= 1e+57) {
tmp = fma(-0.25, (b * a), fma(y, x, c));
} else {
tmp = fma((z * 0.0625), t, fma(x, y, c));
}
return tmp;
}
function code(x, y, z, t, a, b, c) tmp = 0.0 if (Float64(z * t) <= -2e+199) tmp = fma(y, x, fma(Float64(t * z), 0.0625, c)); elseif (Float64(z * t) <= 1e+57) tmp = fma(-0.25, Float64(b * a), fma(y, x, c)); else tmp = fma(Float64(z * 0.0625), t, fma(x, y, c)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[N[(z * t), $MachinePrecision], -2e+199], N[(y * x + N[(N[(t * z), $MachinePrecision] * 0.0625 + c), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1e+57], N[(-0.25 * N[(b * a), $MachinePrecision] + N[(y * x + c), $MachinePrecision]), $MachinePrecision], N[(N[(z * 0.0625), $MachinePrecision] * t + N[(x * y + c), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+199}:\\
\;\;\;\;\mathsf{fma}\left(y, x, \mathsf{fma}\left(t \cdot z, 0.0625, c\right)\right)\\
\mathbf{elif}\;z \cdot t \leq 10^{+57}:\\
\;\;\;\;\mathsf{fma}\left(-0.25, b \cdot a, \mathsf{fma}\left(y, x, c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z \cdot 0.0625, t, \mathsf{fma}\left(x, y, c\right)\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -2.00000000000000019e199Initial program 94.6%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64100.0
Applied rewrites100.0%
if -2.00000000000000019e199 < (*.f64 z t) < 1.00000000000000005e57Initial program 98.8%
Taylor expanded in z around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6494.5
Applied rewrites94.5%
if 1.00000000000000005e57 < (*.f64 z t) Initial program 92.5%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6483.3
Applied rewrites83.3%
Applied rewrites87.0%
(FPCore (x y z t a b c)
:precision binary64
(if (<= (* z t) -2e+199)
(fma y x (* (* t z) 0.0625))
(if (<= (* z t) 1e+219)
(fma -0.25 (* b a) (fma y x c))
(fma (* 0.0625 z) t (* y x)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((z * t) <= -2e+199) {
tmp = fma(y, x, ((t * z) * 0.0625));
} else if ((z * t) <= 1e+219) {
tmp = fma(-0.25, (b * a), fma(y, x, c));
} else {
tmp = fma((0.0625 * z), t, (y * x));
}
return tmp;
}
function code(x, y, z, t, a, b, c) tmp = 0.0 if (Float64(z * t) <= -2e+199) tmp = fma(y, x, Float64(Float64(t * z) * 0.0625)); elseif (Float64(z * t) <= 1e+219) tmp = fma(-0.25, Float64(b * a), fma(y, x, c)); else tmp = fma(Float64(0.0625 * z), t, Float64(y * x)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[N[(z * t), $MachinePrecision], -2e+199], N[(y * x + N[(N[(t * z), $MachinePrecision] * 0.0625), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1e+219], N[(-0.25 * N[(b * a), $MachinePrecision] + N[(y * x + c), $MachinePrecision]), $MachinePrecision], N[(N[(0.0625 * z), $MachinePrecision] * t + N[(y * x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+199}:\\
\;\;\;\;\mathsf{fma}\left(y, x, \left(t \cdot z\right) \cdot 0.0625\right)\\
\mathbf{elif}\;z \cdot t \leq 10^{+219}:\\
\;\;\;\;\mathsf{fma}\left(-0.25, b \cdot a, \mathsf{fma}\left(y, x, c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(0.0625 \cdot z, t, y \cdot x\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -2.00000000000000019e199Initial program 94.6%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64100.0
Applied rewrites100.0%
Taylor expanded in x around 0
Applied rewrites84.9%
Taylor expanded in c around 0
Applied rewrites95.0%
Applied rewrites97.7%
if -2.00000000000000019e199 < (*.f64 z t) < 9.99999999999999965e218Initial program 98.9%
Taylor expanded in z around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6491.0
Applied rewrites91.0%
if 9.99999999999999965e218 < (*.f64 z t) Initial program 88.2%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6482.9
Applied rewrites82.9%
Taylor expanded in x around 0
Applied rewrites80.0%
Taylor expanded in c around 0
Applied rewrites80.0%
Applied rewrites88.8%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= (* z t) -1.25e+188) (not (<= (* z t) 1.08e+64))) (fma (* z t) 0.0625 c) (fma -0.25 (* a b) c)))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (((z * t) <= -1.25e+188) || !((z * t) <= 1.08e+64)) {
tmp = fma((z * t), 0.0625, c);
} else {
tmp = fma(-0.25, (a * b), c);
}
return tmp;
}
function code(x, y, z, t, a, b, c) tmp = 0.0 if ((Float64(z * t) <= -1.25e+188) || !(Float64(z * t) <= 1.08e+64)) tmp = fma(Float64(z * t), 0.0625, c); else tmp = fma(-0.25, Float64(a * b), c); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[N[(z * t), $MachinePrecision], -1.25e+188], N[Not[LessEqual[N[(z * t), $MachinePrecision], 1.08e+64]], $MachinePrecision]], N[(N[(z * t), $MachinePrecision] * 0.0625 + c), $MachinePrecision], N[(-0.25 * N[(a * b), $MachinePrecision] + c), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -1.25 \cdot 10^{+188} \lor \neg \left(z \cdot t \leq 1.08 \cdot 10^{+64}\right):\\
\;\;\;\;\mathsf{fma}\left(z \cdot t, 0.0625, c\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.25, a \cdot b, c\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -1.25e188 or 1.08000000000000007e64 < (*.f64 z t) Initial program 93.5%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6490.3
Applied rewrites90.3%
Taylor expanded in x around 0
Applied rewrites76.9%
if -1.25e188 < (*.f64 z t) < 1.08000000000000007e64Initial program 98.8%
Taylor expanded in z around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6494.4
Applied rewrites94.4%
Taylor expanded in x around 0
Applied rewrites66.7%
Final simplification70.4%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= (* z t) -4.8e+195) (not (<= (* z t) 1.2e+143))) (* (* z t) 0.0625) (fma y x c)))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (((z * t) <= -4.8e+195) || !((z * t) <= 1.2e+143)) {
tmp = (z * t) * 0.0625;
} else {
tmp = fma(y, x, c);
}
return tmp;
}
function code(x, y, z, t, a, b, c) tmp = 0.0 if ((Float64(z * t) <= -4.8e+195) || !(Float64(z * t) <= 1.2e+143)) tmp = Float64(Float64(z * t) * 0.0625); else tmp = fma(y, x, c); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[N[(z * t), $MachinePrecision], -4.8e+195], N[Not[LessEqual[N[(z * t), $MachinePrecision], 1.2e+143]], $MachinePrecision]], N[(N[(z * t), $MachinePrecision] * 0.0625), $MachinePrecision], N[(y * x + c), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -4.8 \cdot 10^{+195} \lor \neg \left(z \cdot t \leq 1.2 \cdot 10^{+143}\right):\\
\;\;\;\;\left(z \cdot t\right) \cdot 0.0625\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, x, c\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -4.8000000000000005e195 or 1.1999999999999999e143 < (*.f64 z t) Initial program 92.8%
lift--.f64N/A
sub-negN/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
div-invN/A
lower-*.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
div-invN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
Applied rewrites96.4%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6476.0
Applied rewrites76.0%
if -4.8000000000000005e195 < (*.f64 z t) < 1.1999999999999999e143Initial program 98.8%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6468.0
Applied rewrites68.0%
Taylor expanded in x around 0
Applied rewrites36.0%
Taylor expanded in z around 0
Applied rewrites62.4%
Final simplification66.8%
(FPCore (x y z t a b c) :precision binary64 (fma -0.25 (* b a) (fma y x (fma (* t z) 0.0625 c))))
double code(double x, double y, double z, double t, double a, double b, double c) {
return fma(-0.25, (b * a), fma(y, x, fma((t * z), 0.0625, c)));
}
function code(x, y, z, t, a, b, c) return fma(-0.25, Float64(b * a), fma(y, x, fma(Float64(t * z), 0.0625, c))) end
code[x_, y_, z_, t_, a_, b_, c_] := N[(-0.25 * N[(b * a), $MachinePrecision] + N[(y * x + N[(N[(t * z), $MachinePrecision] * 0.0625 + c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(-0.25, b \cdot a, \mathsf{fma}\left(y, x, \mathsf{fma}\left(t \cdot z, 0.0625, c\right)\right)\right)
\end{array}
Initial program 96.9%
Taylor expanded in x around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6497.6
Applied rewrites97.6%
(FPCore (x y z t a b c) :precision binary64 (fma y x c))
double code(double x, double y, double z, double t, double a, double b, double c) {
return fma(y, x, c);
}
function code(x, y, z, t, a, b, c) return fma(y, x, c) end
code[x_, y_, z_, t_, a_, b_, c_] := N[(y * x + c), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, x, c\right)
\end{array}
Initial program 96.9%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6475.0
Applied rewrites75.0%
Taylor expanded in x around 0
Applied rewrites50.0%
Taylor expanded in z around 0
Applied rewrites49.1%
(FPCore (x y z t a b c) :precision binary64 (* x y))
double code(double x, double y, double z, double t, double a, double b, double c) {
return x * y;
}
real(8) function code(x, y, z, t, a, b, c)
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), intent (in) :: c
code = x * y
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return x * y;
}
def code(x, y, z, t, a, b, c): return x * y
function code(x, y, z, t, a, b, c) return Float64(x * y) end
function tmp = code(x, y, z, t, a, b, c) tmp = x * y; end
code[x_, y_, z_, t_, a_, b_, c_] := N[(x * y), $MachinePrecision]
\begin{array}{l}
\\
x \cdot y
\end{array}
Initial program 96.9%
lift--.f64N/A
sub-negN/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
div-invN/A
lower-*.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
div-invN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
Applied rewrites98.4%
Taylor expanded in x around inf
lower-*.f6428.4
Applied rewrites28.4%
herbie shell --seed 2024307
(FPCore (x y z t a b c)
:name "Diagrams.Solve.Polynomial:quartForm from diagrams-solve-0.1, C"
:precision binary64
(+ (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0)) c))