
(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 11 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 (fma y i (fma (log c) (- b 0.5) (+ (+ (fma (log y) x z) t) a))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return fma(y, i, fma(log(c), (b - 0.5), ((fma(log(y), x, z) + t) + a)));
}
function code(x, y, z, t, a, b, c, i) return fma(y, i, fma(log(c), Float64(b - 0.5), Float64(Float64(fma(log(y), x, z) + t) + a))) end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(y * i + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + N[(N[(N[(N[Log[y], $MachinePrecision] * x + z), $MachinePrecision] + t), $MachinePrecision] + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, i, \mathsf{fma}\left(\log c, b - 0.5, \left(\mathsf{fma}\left(\log y, x, z\right) + t\right) + a\right)\right)
\end{array}
Initial program 99.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6499.5
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.5
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.5
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.5
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.5
Applied rewrites99.5%
Final simplification99.5%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1
(+
(* i y)
(+ (* (- b 0.5) (log c)) (+ (+ (+ (* x (log y)) z) t) a)))))
(if (<= t_1 (- INFINITY))
(* i y)
(if (<= t_1 -100.0)
(* (/ z i) i)
(if (<= t_1 4e+293) (* (/ a i) i) (* i y))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (i * y) + (((b - 0.5) * log(c)) + ((((x * log(y)) + z) + t) + a));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = i * y;
} else if (t_1 <= -100.0) {
tmp = (z / i) * i;
} else if (t_1 <= 4e+293) {
tmp = (a / i) * i;
} else {
tmp = i * y;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (i * y) + (((b - 0.5) * Math.log(c)) + ((((x * Math.log(y)) + z) + t) + a));
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = i * y;
} else if (t_1 <= -100.0) {
tmp = (z / i) * i;
} else if (t_1 <= 4e+293) {
tmp = (a / i) * i;
} else {
tmp = i * y;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (i * y) + (((b - 0.5) * math.log(c)) + ((((x * math.log(y)) + z) + t) + a)) tmp = 0 if t_1 <= -math.inf: tmp = i * y elif t_1 <= -100.0: tmp = (z / i) * i elif t_1 <= 4e+293: tmp = (a / i) * i else: tmp = i * y return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(i * y) + Float64(Float64(Float64(b - 0.5) * log(c)) + Float64(Float64(Float64(Float64(x * log(y)) + z) + t) + a))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(i * y); elseif (t_1 <= -100.0) tmp = Float64(Float64(z / i) * i); elseif (t_1 <= 4e+293) tmp = Float64(Float64(a / i) * i); else tmp = Float64(i * y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = (i * y) + (((b - 0.5) * log(c)) + ((((x * log(y)) + z) + t) + a)); tmp = 0.0; if (t_1 <= -Inf) tmp = i * y; elseif (t_1 <= -100.0) tmp = (z / i) * i; elseif (t_1 <= 4e+293) tmp = (a / i) * i; else tmp = i * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(i * y), $MachinePrecision] + 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]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(i * y), $MachinePrecision], If[LessEqual[t$95$1, -100.0], N[(N[(z / i), $MachinePrecision] * i), $MachinePrecision], If[LessEqual[t$95$1, 4e+293], N[(N[(a / i), $MachinePrecision] * i), $MachinePrecision], N[(i * y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := i \cdot y + \left(\left(b - 0.5\right) \cdot \log c + \left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right)\right)\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;i \cdot y\\
\mathbf{elif}\;t\_1 \leq -100:\\
\;\;\;\;\frac{z}{i} \cdot i\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+293}:\\
\;\;\;\;\frac{a}{i} \cdot i\\
\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 3.9999999999999997e293 < (+.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 97.8%
Taylor expanded in y around inf
lower-*.f6477.0
Applied rewrites77.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)) < -100Initial program 99.8%
Taylor expanded in i around -inf
mul-1-negN/A
distribute-rgt-neg-inN/A
distribute-lft-outN/A
mul-1-negN/A
remove-double-negN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites60.0%
Taylor expanded in z around inf
Applied rewrites11.4%
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)) < 3.9999999999999997e293Initial program 99.9%
Taylor expanded in i around -inf
mul-1-negN/A
distribute-rgt-neg-inN/A
distribute-lft-outN/A
mul-1-negN/A
remove-double-negN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites65.8%
Taylor expanded in a around inf
Applied rewrites16.7%
Final simplification25.7%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1
(+
(* i y)
(+ (* (- b 0.5) (log c)) (+ (+ (+ (* x (log y)) z) t) a)))))
(if (<= t_1 -100.0)
(fma (/ (* i y) z) z z)
(if (<= t_1 2e+304) (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 = (i * y) + (((b - 0.5) * log(c)) + ((((x * log(y)) + z) + t) + a));
double tmp;
if (t_1 <= -100.0) {
tmp = fma(((i * y) / z), z, z);
} else if (t_1 <= 2e+304) {
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(i * y) + Float64(Float64(Float64(b - 0.5) * log(c)) + Float64(Float64(Float64(Float64(x * log(y)) + z) + t) + a))) tmp = 0.0 if (t_1 <= -100.0) tmp = fma(Float64(Float64(i * y) / z), z, z); elseif (t_1 <= 2e+304) 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[(i * y), $MachinePrecision] + 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]), $MachinePrecision]}, If[LessEqual[t$95$1, -100.0], N[(N[(N[(i * y), $MachinePrecision] / z), $MachinePrecision] * z + z), $MachinePrecision], If[LessEqual[t$95$1, 2e+304], N[(N[(a / z), $MachinePrecision] * z + z), $MachinePrecision], N[(i * y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := i \cdot y + \left(\left(b - 0.5\right) \cdot \log c + \left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right)\right)\\
\mathbf{if}\;t\_1 \leq -100:\\
\;\;\;\;\mathsf{fma}\left(\frac{i \cdot y}{z}, z, z\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+304}:\\
\;\;\;\;\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.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 rewrites75.0%
Taylor expanded in y around inf
Applied rewrites33.8%
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)) < 1.9999999999999999e304Initial 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 rewrites74.2%
Taylor expanded in a around inf
Applied rewrites38.2%
if 1.9999999999999999e304 < (+.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 94.1%
Taylor expanded in y around inf
lower-*.f6488.4
Applied rewrites88.4%
Final simplification39.4%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1
(+
(* i y)
(+ (* (- b 0.5) (log c)) (+ (+ (+ (* x (log y)) z) t) a)))))
(if (<= t_1 (- INFINITY))
(* i y)
(if (<= t_1 2e+304) (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 = (i * y) + (((b - 0.5) * log(c)) + ((((x * log(y)) + z) + t) + a));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = i * y;
} else if (t_1 <= 2e+304) {
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(i * y) + Float64(Float64(Float64(b - 0.5) * log(c)) + Float64(Float64(Float64(Float64(x * log(y)) + z) + t) + a))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(i * y); elseif (t_1 <= 2e+304) 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[(i * y), $MachinePrecision] + 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]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(i * y), $MachinePrecision], If[LessEqual[t$95$1, 2e+304], N[(N[(a / z), $MachinePrecision] * z + z), $MachinePrecision], N[(i * y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := i \cdot y + \left(\left(b - 0.5\right) \cdot \log c + \left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right)\right)\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;i \cdot y\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+304}:\\
\;\;\;\;\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 1.9999999999999999e304 < (+.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 97.4%
Taylor expanded in y around inf
lower-*.f6492.2
Applied rewrites92.2%
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)) < 1.9999999999999999e304Initial 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 rewrites72.1%
Taylor expanded in a around inf
Applied rewrites32.3%
Final simplification41.2%
(FPCore (x y z t a b c i)
:precision binary64
(if (<=
(+ (* i y) (+ (* (- b 0.5) (log c)) (+ (+ (+ (* x (log y)) z) t) a)))
-100.0)
(fma (/ (* i y) z) z z)
(+ (* (/ a x) x) (* i y))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((i * y) + (((b - 0.5) * log(c)) + ((((x * log(y)) + z) + t) + a))) <= -100.0) {
tmp = fma(((i * y) / z), z, z);
} else {
tmp = ((a / x) * x) + (i * y);
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(Float64(i * y) + Float64(Float64(Float64(b - 0.5) * log(c)) + Float64(Float64(Float64(Float64(x * log(y)) + z) + t) + a))) <= -100.0) tmp = fma(Float64(Float64(i * y) / z), z, z); else tmp = Float64(Float64(Float64(a / x) * x) + Float64(i * y)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(N[(i * y), $MachinePrecision] + 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]), $MachinePrecision], -100.0], N[(N[(N[(i * y), $MachinePrecision] / z), $MachinePrecision] * z + z), $MachinePrecision], N[(N[(N[(a / x), $MachinePrecision] * x), $MachinePrecision] + N[(i * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \cdot y + \left(\left(b - 0.5\right) \cdot \log c + \left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right)\right) \leq -100:\\
\;\;\;\;\mathsf{fma}\left(\frac{i \cdot y}{z}, z, z\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{x} \cdot x + 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.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 rewrites75.0%
Taylor expanded in y around inf
Applied rewrites33.8%
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.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites62.7%
Taylor expanded in a around inf
Applied rewrites33.1%
Final simplification33.5%
(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.5%
Taylor expanded in t around 0
+-commutativeN/A
lower-+.f64N/A
Applied rewrites85.2%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ (fma i y (fma (log y) x (* (- z) -1.0))) a)))
(if (<= x -7.8e+184)
t_1
(if (<= x 4.4e+203)
(+ (fma (- b 0.5) (log c) (fma i y z)) (+ t a))
t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(i, y, fma(log(y), x, (-z * -1.0))) + a;
double tmp;
if (x <= -7.8e+184) {
tmp = t_1;
} else if (x <= 4.4e+203) {
tmp = fma((b - 0.5), log(c), fma(i, y, z)) + (t + a);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(fma(i, y, fma(log(y), x, Float64(Float64(-z) * -1.0))) + a) tmp = 0.0 if (x <= -7.8e+184) tmp = t_1; elseif (x <= 4.4e+203) tmp = Float64(fma(Float64(b - 0.5), log(c), fma(i, y, z)) + Float64(t + a)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(i * y + N[(N[Log[y], $MachinePrecision] * x + N[((-z) * -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision]}, If[LessEqual[x, -7.8e+184], t$95$1, If[LessEqual[x, 4.4e+203], N[(N[(N[(b - 0.5), $MachinePrecision] * N[Log[c], $MachinePrecision] + N[(i * y + z), $MachinePrecision]), $MachinePrecision] + N[(t + a), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(i, y, \mathsf{fma}\left(\log y, x, \left(-z\right) \cdot -1\right)\right) + a\\
\mathbf{if}\;x \leq -7.8 \cdot 10^{+184}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 4.4 \cdot 10^{+203}:\\
\;\;\;\;\mathsf{fma}\left(b - 0.5, \log c, \mathsf{fma}\left(i, y, z\right)\right) + \left(t + a\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -7.79999999999999942e184 or 4.40000000000000009e203 < x Initial program 99.8%
Taylor expanded in t around 0
+-commutativeN/A
lower-+.f64N/A
Applied rewrites90.7%
Taylor expanded in z around -inf
Applied rewrites90.9%
Taylor expanded in z around inf
Applied rewrites86.3%
if -7.79999999999999942e184 < x < 4.40000000000000009e203Initial program 99.4%
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.f6496.7
Applied rewrites96.7%
Final simplification95.0%
(FPCore (x y z t a b c i) :precision binary64 (if (<= x -7.8e+251) (* x (log y)) (+ (fma (- b 0.5) (log c) (fma i y z)) (+ t a))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (x <= -7.8e+251) {
tmp = x * log(y);
} else {
tmp = fma((b - 0.5), log(c), fma(i, y, z)) + (t + a);
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (x <= -7.8e+251) tmp = Float64(x * log(y)); else tmp = Float64(fma(Float64(b - 0.5), log(c), fma(i, y, z)) + Float64(t + a)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[x, -7.8e+251], N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision], N[(N[(N[(b - 0.5), $MachinePrecision] * N[Log[c], $MachinePrecision] + N[(i * y + z), $MachinePrecision]), $MachinePrecision] + N[(t + a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.8 \cdot 10^{+251}:\\
\;\;\;\;x \cdot \log y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b - 0.5, \log c, \mathsf{fma}\left(i, y, z\right)\right) + \left(t + a\right)\\
\end{array}
\end{array}
if x < -7.79999999999999951e251Initial program 99.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6499.8
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.9
Applied rewrites99.9%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6465.9
Applied rewrites65.9%
if -7.79999999999999951e251 < x Initial program 99.5%
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.3
Applied rewrites91.3%
Final simplification90.0%
(FPCore (x y z t a b c i) :precision binary64 (if (<= x -1.18e+231) (* x (log y)) (+ (fma i y (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 tmp;
if (x <= -1.18e+231) {
tmp = x * log(y);
} else {
tmp = fma(i, y, fma(log(c), (b - 0.5), z)) + a;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (x <= -1.18e+231) tmp = Float64(x * log(y)); else tmp = Float64(fma(i, y, fma(log(c), Float64(b - 0.5), z)) + a); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[x, -1.18e+231], N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision], N[(N[(i * y + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.18 \cdot 10^{+231}:\\
\;\;\;\;x \cdot \log y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(i, y, \mathsf{fma}\left(\log c, b - 0.5, z\right)\right) + a\\
\end{array}
\end{array}
if x < -1.1799999999999999e231Initial program 99.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6499.7
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.8
Applied rewrites99.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6460.1
Applied rewrites60.1%
if -1.1799999999999999e231 < x Initial program 99.5%
Taylor expanded in t around 0
+-commutativeN/A
lower-+.f64N/A
Applied rewrites84.5%
Taylor expanded in x around 0
Applied rewrites76.7%
Final simplification75.6%
(FPCore (x y z t a b c i) :precision binary64 (if (<= y 1.55e+65) (* (/ a i) i) (* i y)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (y <= 1.55e+65) {
tmp = (a / i) * i;
} else {
tmp = i * y;
}
return tmp;
}
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
real(8) :: tmp
if (y <= 1.55d+65) then
tmp = (a / i) * i
else
tmp = i * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (y <= 1.55e+65) {
tmp = (a / i) * i;
} else {
tmp = i * y;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if y <= 1.55e+65: tmp = (a / i) * i else: tmp = i * y return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (y <= 1.55e+65) tmp = Float64(Float64(a / i) * i); else tmp = Float64(i * y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if (y <= 1.55e+65) tmp = (a / i) * i; else tmp = i * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[y, 1.55e+65], N[(N[(a / i), $MachinePrecision] * i), $MachinePrecision], N[(i * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.55 \cdot 10^{+65}:\\
\;\;\;\;\frac{a}{i} \cdot i\\
\mathbf{else}:\\
\;\;\;\;i \cdot y\\
\end{array}
\end{array}
if y < 1.54999999999999995e65Initial program 99.9%
Taylor expanded in i around -inf
mul-1-negN/A
distribute-rgt-neg-inN/A
distribute-lft-outN/A
mul-1-negN/A
remove-double-negN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites66.4%
Taylor expanded in a around inf
Applied rewrites17.4%
if 1.54999999999999995e65 < y Initial program 98.9%
Taylor expanded in y around inf
lower-*.f6450.5
Applied rewrites50.5%
(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.5%
Taylor expanded in y around inf
lower-*.f6424.4
Applied rewrites24.4%
herbie shell --seed 2024331
(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)))