
(FPCore (x y z t a b c i) :precision binary64 (+ (+ (+ (+ (+ (* x (log y)) z) t) a) (* (- b 0.5) (log c))) (* y i)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((((x * log(y)) + z) + t) + a) + ((b - 0.5) * log(c))) + (y * i);
}
real(8) function code(x, y, z, t, a, b, c, i)
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
real(8), intent (in) :: i
code = (((((x * log(y)) + z) + t) + a) + ((b - 0.5d0) * log(c))) + (y * i)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((((x * Math.log(y)) + z) + t) + a) + ((b - 0.5) * Math.log(c))) + (y * i);
}
def code(x, y, z, t, a, b, c, i): return (((((x * math.log(y)) + z) + t) + a) + ((b - 0.5) * math.log(c))) + (y * i)
function code(x, y, z, t, a, b, c, i) return Float64(Float64(Float64(Float64(Float64(Float64(x * log(y)) + z) + t) + a) + Float64(Float64(b - 0.5) * log(c))) + Float64(y * i)) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = (((((x * log(y)) + z) + t) + a) + ((b - 0.5) * log(c))) + (y * i); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(N[(N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision] + t), $MachinePrecision] + a), $MachinePrecision] + N[(N[(b - 0.5), $MachinePrecision] * N[Log[c], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * i), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \left(b - 0.5\right) \cdot \log c\right) + y \cdot i
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b c i) :precision binary64 (+ (+ (+ (+ (+ (* x (log y)) z) t) a) (* (- b 0.5) (log c))) (* y i)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((((x * log(y)) + z) + t) + a) + ((b - 0.5) * log(c))) + (y * i);
}
real(8) function code(x, y, z, t, a, b, c, i)
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
real(8), intent (in) :: i
code = (((((x * log(y)) + z) + t) + a) + ((b - 0.5d0) * log(c))) + (y * i)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((((x * Math.log(y)) + z) + t) + a) + ((b - 0.5) * Math.log(c))) + (y * i);
}
def code(x, y, z, t, a, b, c, i): return (((((x * math.log(y)) + z) + t) + a) + ((b - 0.5) * math.log(c))) + (y * i)
function code(x, y, z, t, a, b, c, i) return Float64(Float64(Float64(Float64(Float64(Float64(x * log(y)) + z) + t) + a) + Float64(Float64(b - 0.5) * log(c))) + Float64(y * i)) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = (((((x * log(y)) + z) + t) + a) + ((b - 0.5) * log(c))) + (y * i); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(N[(N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision] + t), $MachinePrecision] + a), $MachinePrecision] + N[(N[(b - 0.5), $MachinePrecision] * N[Log[c], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * i), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \left(b - 0.5\right) \cdot \log c\right) + y \cdot i
\end{array}
(FPCore (x y z t a b c i) :precision binary64 (+ (* i y) (+ (* (log c) (- b 0.5)) (+ a (+ t (+ z (* (log y) x)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (i * y) + ((log(c) * (b - 0.5)) + (a + (t + (z + (log(y) * x)))));
}
real(8) function code(x, y, z, t, a, b, c, i)
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
real(8), intent (in) :: i
code = (i * y) + ((log(c) * (b - 0.5d0)) + (a + (t + (z + (log(y) * x)))))
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (i * y) + ((Math.log(c) * (b - 0.5)) + (a + (t + (z + (Math.log(y) * x)))));
}
def code(x, y, z, t, a, b, c, i): return (i * y) + ((math.log(c) * (b - 0.5)) + (a + (t + (z + (math.log(y) * x)))))
function code(x, y, z, t, a, b, c, i) return Float64(Float64(i * y) + Float64(Float64(log(c) * Float64(b - 0.5)) + Float64(a + Float64(t + Float64(z + Float64(log(y) * x)))))) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = (i * y) + ((log(c) * (b - 0.5)) + (a + (t + (z + (log(y) * x))))); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(i * y), $MachinePrecision] + N[(N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision]), $MachinePrecision] + N[(a + N[(t + N[(z + N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
i \cdot y + \left(\log c \cdot \left(b - 0.5\right) + \left(a + \left(t + \left(z + \log y \cdot x\right)\right)\right)\right)
\end{array}
Initial program 99.8%
Final simplification99.8%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (log c) (- b 0.5))))
(if (<= t_1 -2e+145)
(+ (fma i y (fma (log y) x (* (log c) b))) a)
(if (<= t_1 1e+171)
(+ (fma i y (fma (log y) x (fma -0.5 (log c) z))) a)
(+ (fma (log y) x (fma (log c) (- b 0.5) z)) a)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = log(c) * (b - 0.5);
double tmp;
if (t_1 <= -2e+145) {
tmp = fma(i, y, fma(log(y), x, (log(c) * b))) + a;
} else if (t_1 <= 1e+171) {
tmp = fma(i, y, fma(log(y), x, fma(-0.5, log(c), z))) + a;
} else {
tmp = fma(log(y), x, fma(log(c), (b - 0.5), z)) + a;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(log(c) * Float64(b - 0.5)) tmp = 0.0 if (t_1 <= -2e+145) tmp = Float64(fma(i, y, fma(log(y), x, Float64(log(c) * b))) + a); elseif (t_1 <= 1e+171) tmp = Float64(fma(i, y, fma(log(y), x, fma(-0.5, log(c), z))) + a); else tmp = Float64(fma(log(y), x, fma(log(c), Float64(b - 0.5), z)) + a); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+145], N[(N[(i * y + N[(N[Log[y], $MachinePrecision] * x + N[(N[Log[c], $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision], If[LessEqual[t$95$1, 1e+171], N[(N[(i * y + N[(N[Log[y], $MachinePrecision] * x + N[(-0.5 * N[Log[c], $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision], N[(N[(N[Log[y], $MachinePrecision] * x + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log c \cdot \left(b - 0.5\right)\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+145}:\\
\;\;\;\;\mathsf{fma}\left(i, y, \mathsf{fma}\left(\log y, x, \log c \cdot b\right)\right) + a\\
\mathbf{elif}\;t\_1 \leq 10^{+171}:\\
\;\;\;\;\mathsf{fma}\left(i, y, \mathsf{fma}\left(\log y, x, \mathsf{fma}\left(-0.5, \log c, z\right)\right)\right) + a\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x, \mathsf{fma}\left(\log c, b - 0.5, z\right)\right) + a\\
\end{array}
\end{array}
if (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c)) < -2e145Initial program 99.7%
Taylor expanded in t around 0
+-commutativeN/A
lower-+.f64N/A
Applied rewrites94.9%
Taylor expanded in b around 0
Applied rewrites47.1%
Taylor expanded in z around inf
Applied rewrites70.5%
Taylor expanded in b around inf
Applied rewrites90.1%
if -2e145 < (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c)) < 9.99999999999999954e170Initial program 99.9%
Taylor expanded in t around 0
+-commutativeN/A
lower-+.f64N/A
Applied rewrites80.4%
Taylor expanded in b around 0
Applied rewrites79.8%
if 9.99999999999999954e170 < (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c)) Initial program 99.4%
Taylor expanded in t around 0
+-commutativeN/A
lower-+.f64N/A
Applied rewrites86.4%
Taylor expanded in y around 0
Applied rewrites79.1%
Final simplification81.3%
(FPCore (x y z t a b c i)
:precision binary64
(if (<=
(+ (* i y) (+ (* (log c) (- b 0.5)) (+ a (+ t (+ z (* (log y) x))))))
-2e+115)
(fma y i (fma (/ t z) z z))
(fma y i (fma (/ a z) z z))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((i * y) + ((log(c) * (b - 0.5)) + (a + (t + (z + (log(y) * x)))))) <= -2e+115) {
tmp = fma(y, i, fma((t / z), z, z));
} else {
tmp = fma(y, i, fma((a / z), z, z));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(Float64(i * y) + Float64(Float64(log(c) * Float64(b - 0.5)) + Float64(a + Float64(t + Float64(z + Float64(log(y) * x)))))) <= -2e+115) tmp = fma(y, i, fma(Float64(t / z), z, z)); else tmp = fma(y, i, fma(Float64(a / z), z, z)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(N[(i * y), $MachinePrecision] + N[(N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision]), $MachinePrecision] + N[(a + N[(t + N[(z + N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2e+115], N[(y * i + N[(N[(t / z), $MachinePrecision] * z + z), $MachinePrecision]), $MachinePrecision], N[(y * i + N[(N[(a / z), $MachinePrecision] * z + z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \cdot y + \left(\log c \cdot \left(b - 0.5\right) + \left(a + \left(t + \left(z + \log y \cdot x\right)\right)\right)\right) \leq -2 \cdot 10^{+115}:\\
\;\;\;\;\mathsf{fma}\left(y, i, \mathsf{fma}\left(\frac{t}{z}, z, z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, i, \mathsf{fma}\left(\frac{a}{z}, z, z\right)\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 (*.f64 x (log.f64 y)) z) t) a) (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c))) (*.f64 y i)) < -2e115Initial program 99.8%
Taylor expanded in z around inf
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f64N/A
Applied rewrites66.9%
Taylor expanded in a around inf
Applied rewrites43.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6443.8
Applied rewrites43.8%
Taylor expanded in t around inf
Applied rewrites45.2%
if -2e115 < (+.f64 (+.f64 (+.f64 (+.f64 (+.f64 (*.f64 x (log.f64 y)) z) t) a) (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c))) (*.f64 y i)) Initial program 99.7%
Taylor expanded in z around inf
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f64N/A
Applied rewrites68.0%
Taylor expanded in a around inf
Applied rewrites41.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6441.2
Applied rewrites41.2%
Final simplification43.0%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= x -6.6e+137)
(+ (fma (log y) x (fma (log c) (- b 0.5) z)) a)
(if (<= x 4.1e+82)
(+ (fma (- b 0.5) (log c) (fma i y z)) (+ a t))
(+ (fma i y (fma (log y) x (* (log c) b))) a))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (x <= -6.6e+137) {
tmp = fma(log(y), x, fma(log(c), (b - 0.5), z)) + a;
} else if (x <= 4.1e+82) {
tmp = fma((b - 0.5), log(c), fma(i, y, z)) + (a + t);
} else {
tmp = fma(i, y, fma(log(y), x, (log(c) * b))) + a;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (x <= -6.6e+137) tmp = Float64(fma(log(y), x, fma(log(c), Float64(b - 0.5), z)) + a); elseif (x <= 4.1e+82) tmp = Float64(fma(Float64(b - 0.5), log(c), fma(i, y, z)) + Float64(a + t)); else tmp = Float64(fma(i, y, fma(log(y), x, Float64(log(c) * b))) + a); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[x, -6.6e+137], N[(N[(N[Log[y], $MachinePrecision] * x + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision], If[LessEqual[x, 4.1e+82], N[(N[(N[(b - 0.5), $MachinePrecision] * N[Log[c], $MachinePrecision] + N[(i * y + z), $MachinePrecision]), $MachinePrecision] + N[(a + t), $MachinePrecision]), $MachinePrecision], N[(N[(i * y + N[(N[Log[y], $MachinePrecision] * x + N[(N[Log[c], $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.6 \cdot 10^{+137}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x, \mathsf{fma}\left(\log c, b - 0.5, z\right)\right) + a\\
\mathbf{elif}\;x \leq 4.1 \cdot 10^{+82}:\\
\;\;\;\;\mathsf{fma}\left(b - 0.5, \log c, \mathsf{fma}\left(i, y, z\right)\right) + \left(a + t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(i, y, \mathsf{fma}\left(\log y, x, \log c \cdot b\right)\right) + a\\
\end{array}
\end{array}
if x < -6.60000000000000005e137Initial program 99.5%
Taylor expanded in t around 0
+-commutativeN/A
lower-+.f64N/A
Applied rewrites92.7%
Taylor expanded in y around 0
Applied rewrites83.8%
if -6.60000000000000005e137 < x < 4.09999999999999995e82Initial program 99.9%
Taylor expanded in x around 0
associate-+r+N/A
lower-+.f64N/A
lower-+.f64N/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-log.f64N/A
+-commutativeN/A
lower-fma.f6498.3
Applied rewrites98.3%
if 4.09999999999999995e82 < x Initial program 99.7%
Taylor expanded in t around 0
+-commutativeN/A
lower-+.f64N/A
Applied rewrites86.5%
Taylor expanded in b around 0
Applied rewrites73.3%
Taylor expanded in z around inf
Applied rewrites74.4%
Taylor expanded in b around inf
Applied rewrites77.0%
Final simplification91.9%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ (fma (log y) x (fma (log c) (- b 0.5) z)) a)))
(if (<= x -6.6e+137)
t_1
(if (<= x 2.15e+102)
(+ (fma (- b 0.5) (log c) (fma i y z)) (+ a t))
t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(log(y), x, fma(log(c), (b - 0.5), z)) + a;
double tmp;
if (x <= -6.6e+137) {
tmp = t_1;
} else if (x <= 2.15e+102) {
tmp = fma((b - 0.5), log(c), fma(i, y, z)) + (a + t);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(fma(log(y), x, fma(log(c), Float64(b - 0.5), z)) + a) tmp = 0.0 if (x <= -6.6e+137) tmp = t_1; elseif (x <= 2.15e+102) tmp = Float64(fma(Float64(b - 0.5), log(c), fma(i, y, z)) + Float64(a + t)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[Log[y], $MachinePrecision] * x + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision]}, If[LessEqual[x, -6.6e+137], t$95$1, If[LessEqual[x, 2.15e+102], N[(N[(N[(b - 0.5), $MachinePrecision] * N[Log[c], $MachinePrecision] + N[(i * y + z), $MachinePrecision]), $MachinePrecision] + N[(a + t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\log y, x, \mathsf{fma}\left(\log c, b - 0.5, z\right)\right) + a\\
\mathbf{if}\;x \leq -6.6 \cdot 10^{+137}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.15 \cdot 10^{+102}:\\
\;\;\;\;\mathsf{fma}\left(b - 0.5, \log c, \mathsf{fma}\left(i, y, z\right)\right) + \left(a + t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -6.60000000000000005e137 or 2.15e102 < x Initial program 99.6%
Taylor expanded in t around 0
+-commutativeN/A
lower-+.f64N/A
Applied rewrites88.9%
Taylor expanded in y around 0
Applied rewrites78.0%
if -6.60000000000000005e137 < x < 2.15e102Initial program 99.9%
Taylor expanded in x around 0
associate-+r+N/A
lower-+.f64N/A
lower-+.f64N/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-log.f64N/A
+-commutativeN/A
lower-fma.f6498.4
Applied rewrites98.4%
Final simplification91.4%
(FPCore (x y z t a b c i) :precision binary64 (+ (fma i y (fma (log y) x (fma (- b 0.5) (log c) z))) a))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return fma(i, y, fma(log(y), x, fma((b - 0.5), log(c), z))) + a;
}
function code(x, y, z, t, a, b, c, i) return Float64(fma(i, y, fma(log(y), x, fma(Float64(b - 0.5), log(c), z))) + a) end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(i * y + N[(N[Log[y], $MachinePrecision] * x + N[(N[(b - 0.5), $MachinePrecision] * N[Log[c], $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(i, y, \mathsf{fma}\left(\log y, x, \mathsf{fma}\left(b - 0.5, \log c, z\right)\right)\right) + a
\end{array}
Initial program 99.8%
Taylor expanded in t around 0
+-commutativeN/A
lower-+.f64N/A
Applied rewrites83.4%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (log y) x)))
(if (<= x -6.9e+174)
(fma y i (fma (/ t_1 z) z z))
(if (<= x 2.9e+256)
(+ (fma (- b 0.5) (log c) (fma i y z)) (+ a t))
t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = log(y) * x;
double tmp;
if (x <= -6.9e+174) {
tmp = fma(y, i, fma((t_1 / z), z, z));
} else if (x <= 2.9e+256) {
tmp = fma((b - 0.5), log(c), fma(i, y, z)) + (a + t);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(log(y) * x) tmp = 0.0 if (x <= -6.9e+174) tmp = fma(y, i, fma(Float64(t_1 / z), z, z)); elseif (x <= 2.9e+256) tmp = Float64(fma(Float64(b - 0.5), log(c), fma(i, y, z)) + Float64(a + t)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -6.9e+174], N[(y * i + N[(N[(t$95$1 / z), $MachinePrecision] * z + z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.9e+256], N[(N[(N[(b - 0.5), $MachinePrecision] * N[Log[c], $MachinePrecision] + N[(i * y + z), $MachinePrecision]), $MachinePrecision] + N[(a + t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot x\\
\mathbf{if}\;x \leq -6.9 \cdot 10^{+174}:\\
\;\;\;\;\mathsf{fma}\left(y, i, \mathsf{fma}\left(\frac{t\_1}{z}, z, z\right)\right)\\
\mathbf{elif}\;x \leq 2.9 \cdot 10^{+256}:\\
\;\;\;\;\mathsf{fma}\left(b - 0.5, \log c, \mathsf{fma}\left(i, y, z\right)\right) + \left(a + t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -6.9000000000000002e174Initial program 99.5%
Taylor expanded in z around inf
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f64N/A
Applied rewrites53.1%
Taylor expanded in a around inf
Applied rewrites16.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6416.9
Applied rewrites16.9%
Taylor expanded in x around inf
Applied rewrites54.0%
if -6.9000000000000002e174 < x < 2.9000000000000002e256Initial program 99.8%
Taylor expanded in x around 0
associate-+r+N/A
lower-+.f64N/A
lower-+.f64N/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-log.f64N/A
+-commutativeN/A
lower-fma.f6491.8
Applied rewrites91.8%
if 2.9000000000000002e256 < x Initial program 99.4%
Taylor expanded in t around 0
+-commutativeN/A
lower-+.f64N/A
Applied rewrites99.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6483.1
Applied rewrites83.1%
Final simplification86.5%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (log y) x)))
(if (<= x -4e+176)
t_1
(if (<= x 2.9e+256)
(+ (fma (- b 0.5) (log c) (fma i y z)) (+ a t))
t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = log(y) * x;
double tmp;
if (x <= -4e+176) {
tmp = t_1;
} else if (x <= 2.9e+256) {
tmp = fma((b - 0.5), log(c), fma(i, y, z)) + (a + t);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(log(y) * x) tmp = 0.0 if (x <= -4e+176) tmp = t_1; elseif (x <= 2.9e+256) tmp = Float64(fma(Float64(b - 0.5), log(c), fma(i, y, z)) + Float64(a + t)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -4e+176], t$95$1, If[LessEqual[x, 2.9e+256], N[(N[(N[(b - 0.5), $MachinePrecision] * N[Log[c], $MachinePrecision] + N[(i * y + z), $MachinePrecision]), $MachinePrecision] + N[(a + t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot x\\
\mathbf{if}\;x \leq -4 \cdot 10^{+176}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.9 \cdot 10^{+256}:\\
\;\;\;\;\mathsf{fma}\left(b - 0.5, \log c, \mathsf{fma}\left(i, y, z\right)\right) + \left(a + t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -4e176 or 2.9000000000000002e256 < x Initial program 99.5%
Taylor expanded in t around 0
+-commutativeN/A
lower-+.f64N/A
Applied rewrites99.5%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6477.4
Applied rewrites77.4%
if -4e176 < x < 2.9000000000000002e256Initial program 99.8%
Taylor expanded in x around 0
associate-+r+N/A
lower-+.f64N/A
lower-+.f64N/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-log.f64N/A
+-commutativeN/A
lower-fma.f6491.8
Applied rewrites91.8%
Final simplification89.3%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (log y) x)))
(if (<= x -4e+176)
t_1
(if (<= x 2.9e+256) (+ (fma i y (fma (log c) (- b 0.5) z)) a) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = log(y) * x;
double tmp;
if (x <= -4e+176) {
tmp = t_1;
} else if (x <= 2.9e+256) {
tmp = fma(i, y, fma(log(c), (b - 0.5), z)) + a;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(log(y) * x) tmp = 0.0 if (x <= -4e+176) tmp = t_1; elseif (x <= 2.9e+256) tmp = Float64(fma(i, y, fma(log(c), Float64(b - 0.5), z)) + a); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -4e+176], t$95$1, If[LessEqual[x, 2.9e+256], N[(N[(i * y + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot x\\
\mathbf{if}\;x \leq -4 \cdot 10^{+176}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.9 \cdot 10^{+256}:\\
\;\;\;\;\mathsf{fma}\left(i, y, \mathsf{fma}\left(\log c, b - 0.5, z\right)\right) + a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -4e176 or 2.9000000000000002e256 < x Initial program 99.5%
Taylor expanded in t around 0
+-commutativeN/A
lower-+.f64N/A
Applied rewrites99.5%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6477.4
Applied rewrites77.4%
if -4e176 < x < 2.9000000000000002e256Initial program 99.8%
Taylor expanded in t around 0
+-commutativeN/A
lower-+.f64N/A
Applied rewrites80.1%
Taylor expanded in x around 0
Applied rewrites72.7%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (log c) b)))
(if (<= (- b 0.5) -4e+153)
t_1
(if (<= (- b 0.5) 5e+176) (fma y i (fma (/ a z) z z)) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = log(c) * b;
double tmp;
if ((b - 0.5) <= -4e+153) {
tmp = t_1;
} else if ((b - 0.5) <= 5e+176) {
tmp = fma(y, i, fma((a / z), z, z));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(log(c) * b) tmp = 0.0 if (Float64(b - 0.5) <= -4e+153) tmp = t_1; elseif (Float64(b - 0.5) <= 5e+176) tmp = fma(y, i, fma(Float64(a / z), z, z)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[Log[c], $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[N[(b - 0.5), $MachinePrecision], -4e+153], t$95$1, If[LessEqual[N[(b - 0.5), $MachinePrecision], 5e+176], N[(y * i + N[(N[(a / z), $MachinePrecision] * z + z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log c \cdot b\\
\mathbf{if}\;b - 0.5 \leq -4 \cdot 10^{+153}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b - 0.5 \leq 5 \cdot 10^{+176}:\\
\;\;\;\;\mathsf{fma}\left(y, i, \mathsf{fma}\left(\frac{a}{z}, z, z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 b #s(literal 1/2 binary64)) < -4e153 or 5e176 < (-.f64 b #s(literal 1/2 binary64)) Initial program 99.5%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6454.2
Applied rewrites54.2%
if -4e153 < (-.f64 b #s(literal 1/2 binary64)) < 5e176Initial program 99.9%
Taylor expanded in z around inf
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f64N/A
Applied rewrites71.5%
Taylor expanded in a around inf
Applied rewrites49.3%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6449.3
Applied rewrites49.3%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (log y) x)))
(if (<= x -3.85e+174)
t_1
(if (<= x 2.2e+163) (fma y i (fma (/ a z) z z)) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = log(y) * x;
double tmp;
if (x <= -3.85e+174) {
tmp = t_1;
} else if (x <= 2.2e+163) {
tmp = fma(y, i, fma((a / z), z, z));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(log(y) * x) tmp = 0.0 if (x <= -3.85e+174) tmp = t_1; elseif (x <= 2.2e+163) tmp = fma(y, i, fma(Float64(a / z), z, z)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -3.85e+174], t$95$1, If[LessEqual[x, 2.2e+163], N[(y * i + N[(N[(a / z), $MachinePrecision] * z + z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot x\\
\mathbf{if}\;x \leq -3.85 \cdot 10^{+174}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{+163}:\\
\;\;\;\;\mathsf{fma}\left(y, i, \mathsf{fma}\left(\frac{a}{z}, z, z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -3.84999999999999979e174 or 2.19999999999999986e163 < x Initial program 99.6%
Taylor expanded in t around 0
+-commutativeN/A
lower-+.f64N/A
Applied rewrites94.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6467.2
Applied rewrites67.2%
if -3.84999999999999979e174 < x < 2.19999999999999986e163Initial program 99.9%
Taylor expanded in z around inf
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f64N/A
Applied rewrites73.4%
Taylor expanded in a around inf
Applied rewrites49.3%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6449.3
Applied rewrites49.3%
(FPCore (x y z t a b c i) :precision binary64 (fma y i (fma (/ a z) z z)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return fma(y, i, fma((a / z), z, z));
}
function code(x, y, z, t, a, b, c, i) return fma(y, i, fma(Float64(a / z), z, z)) end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(y * i + N[(N[(a / z), $MachinePrecision] * z + z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, i, \mathsf{fma}\left(\frac{a}{z}, z, z\right)\right)
\end{array}
Initial program 99.8%
Taylor expanded in z around inf
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f64N/A
Applied rewrites67.5%
Taylor expanded in a around inf
Applied rewrites42.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6442.4
Applied rewrites42.4%
(FPCore (x y z t a b c i) :precision binary64 (* i y))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return i * y;
}
real(8) function code(x, y, z, t, a, b, c, i)
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
real(8), intent (in) :: i
code = i * y
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return i * y;
}
def code(x, y, z, t, a, b, c, i): return i * y
function code(x, y, z, t, a, b, c, i) return Float64(i * y) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = i * y; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(i * y), $MachinePrecision]
\begin{array}{l}
\\
i \cdot y
\end{array}
Initial program 99.8%
Taylor expanded in y around inf
lower-*.f6422.2
Applied rewrites22.2%
herbie shell --seed 2024294
(FPCore (x y z t a b c i)
:name "Numeric.SpecFunctions:logBeta from math-functions-0.1.5.2, B"
:precision binary64
(+ (+ (+ (+ (+ (* x (log y)) z) t) a) (* (- b 0.5) (log c))) (* y i)))