
(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 9 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) (fma (log y) x (+ (fma (log c) (- b 0.5) a) (+ z t)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (i * y) + fma(log(y), x, (fma(log(c), (b - 0.5), a) + (z + t)));
}
function code(x, y, z, t, a, b, c, i) return Float64(Float64(i * y) + fma(log(y), x, Float64(fma(log(c), Float64(b - 0.5), a) + Float64(z + t)))) end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(i * y), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * x + N[(N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + a), $MachinePrecision] + N[(z + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
i \cdot y + \mathsf{fma}\left(\log y, x, \mathsf{fma}\left(\log c, b - 0.5, a\right) + \left(z + t\right)\right)
\end{array}
Initial program 99.8%
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
associate-+l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.8
Applied rewrites99.8%
Final simplification99.8%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1
(+
(+ (* (- b 0.5) (log c)) (+ (+ (+ (* x (log y)) z) t) a))
(* i y))))
(if (<= t_1 -100.0)
(fma (/ (* i y) z) z z)
(if (<= t_1 INFINITY) (fma (/ a z) z z) (* i y)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (((b - 0.5) * log(c)) + ((((x * log(y)) + z) + t) + a)) + (i * y);
double tmp;
if (t_1 <= -100.0) {
tmp = fma(((i * y) / z), z, z);
} else if (t_1 <= ((double) INFINITY)) {
tmp = fma((a / z), z, z);
} else {
tmp = i * y;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(Float64(b - 0.5) * log(c)) + Float64(Float64(Float64(Float64(x * log(y)) + z) + t) + a)) + Float64(i * y)) tmp = 0.0 if (t_1 <= -100.0) tmp = fma(Float64(Float64(i * y) / z), z, z); elseif (t_1 <= Inf) tmp = fma(Float64(a / z), z, z); else tmp = Float64(i * y); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(N[(b - 0.5), $MachinePrecision] * N[Log[c], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision] + t), $MachinePrecision] + a), $MachinePrecision]), $MachinePrecision] + N[(i * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -100.0], N[(N[(N[(i * y), $MachinePrecision] / z), $MachinePrecision] * z + z), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(a / z), $MachinePrecision] * z + z), $MachinePrecision], N[(i * y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(b - 0.5\right) \cdot \log c + \left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right)\right) + i \cdot y\\
\mathbf{if}\;t\_1 \leq -100:\\
\;\;\;\;\mathsf{fma}\left(\frac{i \cdot y}{z}, z, z\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(\frac{a}{z}, z, z\right)\\
\mathbf{else}:\\
\;\;\;\;i \cdot y\\
\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)) < -100Initial program 99.8%
Taylor expanded in z around -inf
associate-*r*N/A
sub-negN/A
metadata-evalN/A
distribute-rgt-inN/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
metadata-evalN/A
*-lft-identityN/A
associate-*r*N/A
Applied rewrites74.8%
Taylor expanded in y around inf
Applied rewrites34.5%
if -100 < (+.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)) < +inf.0Initial program 99.8%
Taylor expanded in z around -inf
associate-*r*N/A
sub-negN/A
metadata-evalN/A
distribute-rgt-inN/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
metadata-evalN/A
*-lft-identityN/A
associate-*r*N/A
Applied rewrites77.9%
Taylor expanded in a around inf
Applied rewrites28.1%
if +inf.0 < (+.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.8%
Taylor expanded in y around inf
lower-*.f6423.3
Applied rewrites23.3%
Final simplification31.3%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1
(+
(+ (* (- b 0.5) (log c)) (+ (+ (+ (* x (log y)) z) t) a))
(* i y))))
(if (<= t_1 (- INFINITY))
(* i y)
(if (<= t_1 INFINITY) (fma (/ a z) z z) (* i y)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (((b - 0.5) * log(c)) + ((((x * log(y)) + z) + t) + a)) + (i * y);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = i * y;
} else if (t_1 <= ((double) INFINITY)) {
tmp = fma((a / z), z, z);
} else {
tmp = i * y;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(Float64(b - 0.5) * log(c)) + Float64(Float64(Float64(Float64(x * log(y)) + z) + t) + a)) + Float64(i * y)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(i * y); elseif (t_1 <= Inf) tmp = fma(Float64(a / z), z, z); else tmp = Float64(i * y); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(N[(b - 0.5), $MachinePrecision] * N[Log[c], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision] + t), $MachinePrecision] + a), $MachinePrecision]), $MachinePrecision] + N[(i * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(i * y), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(a / z), $MachinePrecision] * z + z), $MachinePrecision], N[(i * y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(b - 0.5\right) \cdot \log c + \left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right)\right) + i \cdot y\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;i \cdot y\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(\frac{a}{z}, z, z\right)\\
\mathbf{else}:\\
\;\;\;\;i \cdot y\\
\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)) < -inf.0 or +inf.0 < (+.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 100.0%
Taylor expanded in y around inf
lower-*.f6495.0
Applied rewrites95.0%
if -inf.0 < (+.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)) < +inf.0Initial program 99.8%
Taylor expanded in z around -inf
associate-*r*N/A
sub-negN/A
metadata-evalN/A
distribute-rgt-inN/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
metadata-evalN/A
*-lft-identityN/A
associate-*r*N/A
Applied rewrites74.3%
Taylor expanded in a around inf
Applied rewrites28.1%
Final simplification33.3%
(FPCore (x y z t a b c i)
:precision binary64
(if (<=
(+ (+ (* (- b 0.5) (log c)) (+ (+ (+ (* x (log y)) z) t) a)) (* i y))
-100.0)
(fma (/ (* i y) z) z z)
(fma y i (* (/ a x) x))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((((b - 0.5) * log(c)) + ((((x * log(y)) + z) + t) + a)) + (i * y)) <= -100.0) {
tmp = fma(((i * y) / z), z, z);
} else {
tmp = fma(y, i, ((a / x) * x));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(Float64(Float64(Float64(b - 0.5) * log(c)) + Float64(Float64(Float64(Float64(x * log(y)) + z) + t) + a)) + Float64(i * y)) <= -100.0) tmp = fma(Float64(Float64(i * y) / z), z, z); else tmp = fma(y, i, Float64(Float64(a / x) * x)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(N[(N[(N[(b - 0.5), $MachinePrecision] * N[Log[c], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision] + t), $MachinePrecision] + a), $MachinePrecision]), $MachinePrecision] + N[(i * y), $MachinePrecision]), $MachinePrecision], -100.0], N[(N[(N[(i * y), $MachinePrecision] / z), $MachinePrecision] * z + z), $MachinePrecision], N[(y * i + N[(N[(a / x), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(\left(b - 0.5\right) \cdot \log c + \left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right)\right) + i \cdot y \leq -100:\\
\;\;\;\;\mathsf{fma}\left(\frac{i \cdot y}{z}, z, z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, i, \frac{a}{x} \cdot x\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)) < -100Initial program 99.8%
Taylor expanded in z around -inf
associate-*r*N/A
sub-negN/A
metadata-evalN/A
distribute-rgt-inN/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
metadata-evalN/A
*-lft-identityN/A
associate-*r*N/A
Applied rewrites74.8%
Taylor expanded in y around inf
Applied rewrites34.5%
if -100 < (+.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.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites79.4%
Taylor expanded in z around inf
Applied rewrites42.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6442.2
Applied rewrites42.2%
Taylor expanded in a around inf
Applied rewrites28.4%
Final simplification31.5%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ (fma (- b 0.5) (log c) (fma (log y) x z)) (+ a t))))
(if (<= x -9.5e+121)
t_1
(if (<= x 1.75e+196)
(+ (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((b - 0.5), log(c), fma(log(y), x, z)) + (a + t);
double tmp;
if (x <= -9.5e+121) {
tmp = t_1;
} else if (x <= 1.75e+196) {
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(Float64(b - 0.5), log(c), fma(log(y), x, z)) + Float64(a + t)) tmp = 0.0 if (x <= -9.5e+121) tmp = t_1; elseif (x <= 1.75e+196) 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[(b - 0.5), $MachinePrecision] * N[Log[c], $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * x + z), $MachinePrecision]), $MachinePrecision] + N[(a + t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -9.5e+121], t$95$1, If[LessEqual[x, 1.75e+196], 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(b - 0.5, \log c, \mathsf{fma}\left(\log y, x, z\right)\right) + \left(a + t\right)\\
\mathbf{if}\;x \leq -9.5 \cdot 10^{+121}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.75 \cdot 10^{+196}:\\
\;\;\;\;\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 < -9.49999999999999949e121 or 1.7499999999999999e196 < x Initial program 99.6%
Taylor expanded in y 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
*-commutativeN/A
lower-fma.f64N/A
lower-log.f6487.8
Applied rewrites87.8%
if -9.49999999999999949e121 < x < 1.7499999999999999e196Initial 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.f6497.3
Applied rewrites97.3%
Final simplification94.6%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma (/ a z) z z)))
(if (<= z -1.85e+170)
(fma (/ (* i y) z) z z)
(if (<= z -1.9e+126)
t_1
(if (<= z -1.8e+48)
(fma y i (* x (log y)))
(if (<= z -6.6e+22)
t_1
(if (<= z 5.6e-67) (fma y i (* b (log c))) t_1)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma((a / z), z, z);
double tmp;
if (z <= -1.85e+170) {
tmp = fma(((i * y) / z), z, z);
} else if (z <= -1.9e+126) {
tmp = t_1;
} else if (z <= -1.8e+48) {
tmp = fma(y, i, (x * log(y)));
} else if (z <= -6.6e+22) {
tmp = t_1;
} else if (z <= 5.6e-67) {
tmp = fma(y, i, (b * log(c)));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(Float64(a / z), z, z) tmp = 0.0 if (z <= -1.85e+170) tmp = fma(Float64(Float64(i * y) / z), z, z); elseif (z <= -1.9e+126) tmp = t_1; elseif (z <= -1.8e+48) tmp = fma(y, i, Float64(x * log(y))); elseif (z <= -6.6e+22) tmp = t_1; elseif (z <= 5.6e-67) tmp = fma(y, i, Float64(b * log(c))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(a / z), $MachinePrecision] * z + z), $MachinePrecision]}, If[LessEqual[z, -1.85e+170], N[(N[(N[(i * y), $MachinePrecision] / z), $MachinePrecision] * z + z), $MachinePrecision], If[LessEqual[z, -1.9e+126], t$95$1, If[LessEqual[z, -1.8e+48], N[(y * i + N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -6.6e+22], t$95$1, If[LessEqual[z, 5.6e-67], N[(y * i + N[(b * N[Log[c], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{a}{z}, z, z\right)\\
\mathbf{if}\;z \leq -1.85 \cdot 10^{+170}:\\
\;\;\;\;\mathsf{fma}\left(\frac{i \cdot y}{z}, z, z\right)\\
\mathbf{elif}\;z \leq -1.9 \cdot 10^{+126}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.8 \cdot 10^{+48}:\\
\;\;\;\;\mathsf{fma}\left(y, i, x \cdot \log y\right)\\
\mathbf{elif}\;z \leq -6.6 \cdot 10^{+22}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 5.6 \cdot 10^{-67}:\\
\;\;\;\;\mathsf{fma}\left(y, i, b \cdot \log c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.84999999999999994e170Initial program 99.8%
Taylor expanded in z around -inf
associate-*r*N/A
sub-negN/A
metadata-evalN/A
distribute-rgt-inN/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
metadata-evalN/A
*-lft-identityN/A
associate-*r*N/A
Applied rewrites99.7%
Taylor expanded in y around inf
Applied rewrites59.7%
if -1.84999999999999994e170 < z < -1.90000000000000008e126 or -1.79999999999999992e48 < z < -6.5999999999999996e22 or 5.60000000000000021e-67 < z Initial program 99.9%
Taylor expanded in z around -inf
associate-*r*N/A
sub-negN/A
metadata-evalN/A
distribute-rgt-inN/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
metadata-evalN/A
*-lft-identityN/A
associate-*r*N/A
Applied rewrites99.0%
Taylor expanded in a around inf
Applied rewrites39.7%
if -1.90000000000000008e126 < z < -1.79999999999999992e48Initial program 99.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6443.9
Applied rewrites43.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6443.9
Applied rewrites43.9%
if -6.5999999999999996e22 < z < 5.60000000000000021e-67Initial program 99.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites80.2%
Taylor expanded in z around inf
Applied rewrites45.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6445.5
Applied rewrites45.5%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6447.9
Applied rewrites47.9%
Final simplification45.7%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma y i (* (+ (/ a x) (log y)) x))))
(if (<= x -8.5e+234)
t_1
(if (<= x 2.3e+194)
(+ (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(y, i, (((a / x) + log(y)) * x));
double tmp;
if (x <= -8.5e+234) {
tmp = t_1;
} else if (x <= 2.3e+194) {
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 = fma(y, i, Float64(Float64(Float64(a / x) + log(y)) * x)) tmp = 0.0 if (x <= -8.5e+234) tmp = t_1; elseif (x <= 2.3e+194) 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[(y * i + N[(N[(N[(a / x), $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -8.5e+234], t$95$1, If[LessEqual[x, 2.3e+194], 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(y, i, \left(\frac{a}{x} + \log y\right) \cdot x\right)\\
\mathbf{if}\;x \leq -8.5 \cdot 10^{+234}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{+194}:\\
\;\;\;\;\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 < -8.49999999999999989e234 or 2.30000000000000005e194 < x Initial program 99.5%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.5%
Taylor expanded in z around inf
Applied rewrites82.1%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6482.1
Applied rewrites82.1%
Taylor expanded in a around inf
Applied rewrites83.0%
if -8.49999999999999989e234 < x < 2.30000000000000005e194Initial 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.f6493.2
Applied rewrites93.2%
Final simplification91.5%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma y i (* x (log y)))))
(if (<= x -6.8e+246)
t_1
(if (<= x 2.6e+218)
(+ (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(y, i, (x * log(y)));
double tmp;
if (x <= -6.8e+246) {
tmp = t_1;
} else if (x <= 2.6e+218) {
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 = fma(y, i, Float64(x * log(y))) tmp = 0.0 if (x <= -6.8e+246) tmp = t_1; elseif (x <= 2.6e+218) 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[(y * i + N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6.8e+246], t$95$1, If[LessEqual[x, 2.6e+218], 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(y, i, x \cdot \log y\right)\\
\mathbf{if}\;x \leq -6.8 \cdot 10^{+246}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{+218}:\\
\;\;\;\;\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.79999999999999977e246 or 2.60000000000000002e218 < x Initial program 99.4%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6486.2
Applied rewrites86.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6486.2
Applied rewrites86.2%
if -6.79999999999999977e246 < x < 2.60000000000000002e218Initial 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.f6491.9
Applied rewrites91.9%
Final simplification91.2%
(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-*.f6423.3
Applied rewrites23.3%
herbie shell --seed 2024276
(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)))