
(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 (fma y i (fma (log c) (- b 0.5) (+ a (+ t (fma (log y) x z))))))
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), (a + (t + fma(log(y), x, z)))));
}
function code(x, y, z, t, a, b, c, i) return fma(y, i, fma(log(c), Float64(b - 0.5), Float64(a + Float64(t + fma(log(y), x, z))))) end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(y * i + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + N[(a + N[(t + N[(N[Log[y], $MachinePrecision] * x + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, i, \mathsf{fma}\left(\log c, b - 0.5, a + \left(t + \mathsf{fma}\left(\log y, x, z\right)\right)\right)\right)
\end{array}
Initial program 99.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6499.9
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%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1
(+
(+ (+ (+ (+ (* x (log y)) z) t) a) (* (- b 0.5) (log c)))
(* y i))))
(if (<= t_1 -1e+298)
(* i y)
(if (<= t_1 -4e+292)
(* (log y) x)
(if (<= t_1 -40.0)
(* (/ z i) i)
(if (<= t_1 5e+307) (* (/ 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 = (((((x * log(y)) + z) + t) + a) + ((b - 0.5) * log(c))) + (y * i);
double tmp;
if (t_1 <= -1e+298) {
tmp = i * y;
} else if (t_1 <= -4e+292) {
tmp = log(y) * x;
} else if (t_1 <= -40.0) {
tmp = (z / i) * i;
} else if (t_1 <= 5e+307) {
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) :: t_1
real(8) :: tmp
t_1 = (((((x * log(y)) + z) + t) + a) + ((b - 0.5d0) * log(c))) + (y * i)
if (t_1 <= (-1d+298)) then
tmp = i * y
else if (t_1 <= (-4d+292)) then
tmp = log(y) * x
else if (t_1 <= (-40.0d0)) then
tmp = (z / i) * i
else if (t_1 <= 5d+307) 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 t_1 = (((((x * Math.log(y)) + z) + t) + a) + ((b - 0.5) * Math.log(c))) + (y * i);
double tmp;
if (t_1 <= -1e+298) {
tmp = i * y;
} else if (t_1 <= -4e+292) {
tmp = Math.log(y) * x;
} else if (t_1 <= -40.0) {
tmp = (z / i) * i;
} else if (t_1 <= 5e+307) {
tmp = (a / i) * i;
} else {
tmp = i * y;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (((((x * math.log(y)) + z) + t) + a) + ((b - 0.5) * math.log(c))) + (y * i) tmp = 0 if t_1 <= -1e+298: tmp = i * y elif t_1 <= -4e+292: tmp = math.log(y) * x elif t_1 <= -40.0: tmp = (z / i) * i elif t_1 <= 5e+307: tmp = (a / i) * i else: tmp = i * y return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(Float64(Float64(Float64(x * log(y)) + z) + t) + a) + Float64(Float64(b - 0.5) * log(c))) + Float64(y * i)) tmp = 0.0 if (t_1 <= -1e+298) tmp = Float64(i * y); elseif (t_1 <= -4e+292) tmp = Float64(log(y) * x); elseif (t_1 <= -40.0) tmp = Float64(Float64(z / i) * i); elseif (t_1 <= 5e+307) 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 = (((((x * log(y)) + z) + t) + a) + ((b - 0.5) * log(c))) + (y * i); tmp = 0.0; if (t_1 <= -1e+298) tmp = i * y; elseif (t_1 <= -4e+292) tmp = log(y) * x; elseif (t_1 <= -40.0) tmp = (z / i) * i; elseif (t_1 <= 5e+307) 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[(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]}, If[LessEqual[t$95$1, -1e+298], N[(i * y), $MachinePrecision], If[LessEqual[t$95$1, -4e+292], N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision], If[LessEqual[t$95$1, -40.0], N[(N[(z / i), $MachinePrecision] * i), $MachinePrecision], If[LessEqual[t$95$1, 5e+307], N[(N[(a / i), $MachinePrecision] * i), $MachinePrecision], N[(i * y), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \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\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+298}:\\
\;\;\;\;i \cdot y\\
\mathbf{elif}\;t\_1 \leq -4 \cdot 10^{+292}:\\
\;\;\;\;\log y \cdot x\\
\mathbf{elif}\;t\_1 \leq -40:\\
\;\;\;\;\frac{z}{i} \cdot i\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+307}:\\
\;\;\;\;\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)) < -9.9999999999999996e297 or 5e307 < (+.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.9%
Taylor expanded in y around inf
lower-*.f6467.9
Applied rewrites67.9%
if -9.9999999999999996e297 < (+.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)) < -4.0000000000000001e292Initial 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%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6467.6
Applied rewrites67.6%
if -4.0000000000000001e292 < (+.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)) < -40Initial program 99.9%
Taylor expanded in i around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites69.7%
Taylor expanded in t around inf
Applied rewrites10.5%
Taylor expanded in z around inf
Applied rewrites9.9%
if -40 < (+.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)) < 5e307Initial program 99.8%
Taylor expanded in i around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites64.6%
Taylor expanded in a around inf
Applied rewrites10.9%
Final simplification23.4%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1
(+
(+ (+ (+ (+ (* x (log y)) z) t) a) (* (- b 0.5) (log c)))
(* y i))))
(if (<= t_1 -1e+298)
(* i y)
(if (<= t_1 -40.0)
(* (/ z i) i)
(if (<= t_1 5e+307) (* (/ 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 = (((((x * log(y)) + z) + t) + a) + ((b - 0.5) * log(c))) + (y * i);
double tmp;
if (t_1 <= -1e+298) {
tmp = i * y;
} else if (t_1 <= -40.0) {
tmp = (z / i) * i;
} else if (t_1 <= 5e+307) {
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) :: t_1
real(8) :: tmp
t_1 = (((((x * log(y)) + z) + t) + a) + ((b - 0.5d0) * log(c))) + (y * i)
if (t_1 <= (-1d+298)) then
tmp = i * y
else if (t_1 <= (-40.0d0)) then
tmp = (z / i) * i
else if (t_1 <= 5d+307) 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 t_1 = (((((x * Math.log(y)) + z) + t) + a) + ((b - 0.5) * Math.log(c))) + (y * i);
double tmp;
if (t_1 <= -1e+298) {
tmp = i * y;
} else if (t_1 <= -40.0) {
tmp = (z / i) * i;
} else if (t_1 <= 5e+307) {
tmp = (a / i) * i;
} else {
tmp = i * y;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (((((x * math.log(y)) + z) + t) + a) + ((b - 0.5) * math.log(c))) + (y * i) tmp = 0 if t_1 <= -1e+298: tmp = i * y elif t_1 <= -40.0: tmp = (z / i) * i elif t_1 <= 5e+307: tmp = (a / i) * i else: tmp = i * y return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(Float64(Float64(Float64(x * log(y)) + z) + t) + a) + Float64(Float64(b - 0.5) * log(c))) + Float64(y * i)) tmp = 0.0 if (t_1 <= -1e+298) tmp = Float64(i * y); elseif (t_1 <= -40.0) tmp = Float64(Float64(z / i) * i); elseif (t_1 <= 5e+307) 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 = (((((x * log(y)) + z) + t) + a) + ((b - 0.5) * log(c))) + (y * i); tmp = 0.0; if (t_1 <= -1e+298) tmp = i * y; elseif (t_1 <= -40.0) tmp = (z / i) * i; elseif (t_1 <= 5e+307) 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[(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]}, If[LessEqual[t$95$1, -1e+298], N[(i * y), $MachinePrecision], If[LessEqual[t$95$1, -40.0], N[(N[(z / i), $MachinePrecision] * i), $MachinePrecision], If[LessEqual[t$95$1, 5e+307], N[(N[(a / i), $MachinePrecision] * i), $MachinePrecision], N[(i * y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \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\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+298}:\\
\;\;\;\;i \cdot y\\
\mathbf{elif}\;t\_1 \leq -40:\\
\;\;\;\;\frac{z}{i} \cdot i\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+307}:\\
\;\;\;\;\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)) < -9.9999999999999996e297 or 5e307 < (+.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.9%
Taylor expanded in y around inf
lower-*.f6467.9
Applied rewrites67.9%
if -9.9999999999999996e297 < (+.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)) < -40Initial program 99.9%
Taylor expanded in i around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites68.7%
Taylor expanded in t around inf
Applied rewrites9.9%
Taylor expanded in z around inf
Applied rewrites9.2%
if -40 < (+.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)) < 5e307Initial program 99.8%
Taylor expanded in i around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites64.6%
Taylor expanded in a around inf
Applied rewrites10.9%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (- b 0.5) (log c))))
(if (or (<= t_1 -5e+249) (not (<= t_1 2e+283)))
(* (log c) b)
(+ (fma i y (fma -0.5 (log c) z)) a))))
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);
double tmp;
if ((t_1 <= -5e+249) || !(t_1 <= 2e+283)) {
tmp = log(c) * b;
} else {
tmp = fma(i, y, fma(-0.5, log(c), z)) + a;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(b - 0.5) * log(c)) tmp = 0.0 if ((t_1 <= -5e+249) || !(t_1 <= 2e+283)) tmp = Float64(log(c) * b); else tmp = Float64(fma(i, y, fma(-0.5, log(c), z)) + a); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(b - 0.5), $MachinePrecision] * N[Log[c], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -5e+249], N[Not[LessEqual[t$95$1, 2e+283]], $MachinePrecision]], N[(N[Log[c], $MachinePrecision] * b), $MachinePrecision], N[(N[(i * y + N[(-0.5 * N[Log[c], $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(b - 0.5\right) \cdot \log c\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+249} \lor \neg \left(t\_1 \leq 2 \cdot 10^{+283}\right):\\
\;\;\;\;\log c \cdot b\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(i, y, \mathsf{fma}\left(-0.5, \log c, z\right)\right) + a\\
\end{array}
\end{array}
if (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c)) < -4.9999999999999996e249 or 1.99999999999999991e283 < (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c)) Initial program 99.9%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6474.7
Applied rewrites74.7%
if -4.9999999999999996e249 < (*.f64 (-.f64 b #s(literal 1/2 binary64)) (log.f64 c)) < 1.99999999999999991e283Initial program 99.9%
Taylor expanded in t around 0
+-commutativeN/A
lower-+.f64N/A
Applied rewrites88.5%
Taylor expanded in x around 0
Applied rewrites72.2%
Taylor expanded in b around 0
Applied rewrites63.2%
Final simplification64.1%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (- b 0.5) -5e+27)
(+ (+ (+ (+ t z) a) (* (- b 0.5) (log c))) (* y i))
(if (<= (- b 0.5) 5e+150)
(+ (fma i y (fma (log y) x (fma -0.5 (log c) z))) a)
(+ (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 ((b - 0.5) <= -5e+27) {
tmp = (((t + z) + a) + ((b - 0.5) * log(c))) + (y * i);
} else if ((b - 0.5) <= 5e+150) {
tmp = fma(i, y, fma(log(y), x, fma(-0.5, log(c), z))) + a;
} 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 (Float64(b - 0.5) <= -5e+27) tmp = Float64(Float64(Float64(Float64(t + z) + a) + Float64(Float64(b - 0.5) * log(c))) + Float64(y * i)); elseif (Float64(b - 0.5) <= 5e+150) tmp = Float64(fma(i, y, fma(log(y), x, fma(-0.5, log(c), z))) + a); 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[N[(b - 0.5), $MachinePrecision], -5e+27], N[(N[(N[(N[(t + z), $MachinePrecision] + a), $MachinePrecision] + N[(N[(b - 0.5), $MachinePrecision] * N[Log[c], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(b - 0.5), $MachinePrecision], 5e+150], 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[(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}\;b - 0.5 \leq -5 \cdot 10^{+27}:\\
\;\;\;\;\left(\left(\left(t + z\right) + a\right) + \left(b - 0.5\right) \cdot \log c\right) + y \cdot i\\
\mathbf{elif}\;b - 0.5 \leq 5 \cdot 10^{+150}:\\
\;\;\;\;\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(i, y, \mathsf{fma}\left(\log c, b - 0.5, z\right)\right) + a\\
\end{array}
\end{array}
if (-.f64 b #s(literal 1/2 binary64)) < -4.99999999999999979e27Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
lower-+.f64N/A
lower-+.f6489.6
Applied rewrites89.6%
if -4.99999999999999979e27 < (-.f64 b #s(literal 1/2 binary64)) < 5.00000000000000009e150Initial program 99.9%
Taylor expanded in t around 0
+-commutativeN/A
lower-+.f64N/A
Applied rewrites88.5%
Taylor expanded in b around 0
Applied rewrites87.3%
if 5.00000000000000009e150 < (-.f64 b #s(literal 1/2 binary64)) Initial program 99.8%
Taylor expanded in t around 0
+-commutativeN/A
lower-+.f64N/A
Applied rewrites83.9%
Taylor expanded in x around 0
Applied rewrites79.6%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma (log c) (- b 0.5) z)))
(if (<= i -1.9e+14)
(+ (fma i y t_1) a)
(if (<= i 2.4e-85) (+ (fma (log y) x t_1) a) (fma y i (+ (+ t_1 t) a))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(log(c), (b - 0.5), z);
double tmp;
if (i <= -1.9e+14) {
tmp = fma(i, y, t_1) + a;
} else if (i <= 2.4e-85) {
tmp = fma(log(y), x, t_1) + a;
} else {
tmp = fma(y, i, ((t_1 + t) + a));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(log(c), Float64(b - 0.5), z) tmp = 0.0 if (i <= -1.9e+14) tmp = Float64(fma(i, y, t_1) + a); elseif (i <= 2.4e-85) tmp = Float64(fma(log(y), x, t_1) + a); else tmp = fma(y, i, Float64(Float64(t_1 + t) + 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] + z), $MachinePrecision]}, If[LessEqual[i, -1.9e+14], N[(N[(i * y + t$95$1), $MachinePrecision] + a), $MachinePrecision], If[LessEqual[i, 2.4e-85], N[(N[(N[Log[y], $MachinePrecision] * x + t$95$1), $MachinePrecision] + a), $MachinePrecision], N[(y * i + N[(N[(t$95$1 + t), $MachinePrecision] + a), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\log c, b - 0.5, z\right)\\
\mathbf{if}\;i \leq -1.9 \cdot 10^{+14}:\\
\;\;\;\;\mathsf{fma}\left(i, y, t\_1\right) + a\\
\mathbf{elif}\;i \leq 2.4 \cdot 10^{-85}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x, t\_1\right) + a\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, i, \left(t\_1 + t\right) + a\right)\\
\end{array}
\end{array}
if i < -1.9e14Initial program 99.9%
Taylor expanded in t around 0
+-commutativeN/A
lower-+.f64N/A
Applied rewrites95.4%
Taylor expanded in x around 0
Applied rewrites85.7%
if -1.9e14 < i < 2.4000000000000001e-85Initial program 99.8%
Taylor expanded in t around 0
+-commutativeN/A
lower-+.f64N/A
Applied rewrites83.6%
Taylor expanded in y around 0
Applied rewrites82.5%
if 2.4000000000000001e-85 < i Initial program 99.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6499.9
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 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-log.f64N/A
lower--.f6490.1
Applied rewrites90.1%
(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.9%
Taylor expanded in t around 0
+-commutativeN/A
lower-+.f64N/A
Applied rewrites89.2%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= x -1.2e+246) (not (<= x 7.5e+258))) (* (log y) x) (fma y i (+ (+ (fma (log c) (- b 0.5) 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 <= -1.2e+246) || !(x <= 7.5e+258)) {
tmp = log(y) * x;
} else {
tmp = fma(y, i, ((fma(log(c), (b - 0.5), z) + t) + a));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((x <= -1.2e+246) || !(x <= 7.5e+258)) tmp = Float64(log(y) * x); else tmp = fma(y, i, Float64(Float64(fma(log(c), Float64(b - 0.5), z) + t) + a)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[x, -1.2e+246], N[Not[LessEqual[x, 7.5e+258]], $MachinePrecision]], N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision], N[(y * i + N[(N[(N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision] + z), $MachinePrecision] + t), $MachinePrecision] + a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.2 \cdot 10^{+246} \lor \neg \left(x \leq 7.5 \cdot 10^{+258}\right):\\
\;\;\;\;\log y \cdot x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, i, \left(\mathsf{fma}\left(\log c, b - 0.5, z\right) + t\right) + a\right)\\
\end{array}
\end{array}
if x < -1.2e246 or 7.50000000000000032e258 < x Initial program 99.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6499.6
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.6
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.6
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.6
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.6
Applied rewrites99.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6475.9
Applied rewrites75.9%
if -1.2e246 < x < 7.50000000000000032e258Initial program 99.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6499.9
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 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-log.f64N/A
lower--.f6490.0
Applied rewrites90.0%
Final simplification88.7%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= x -1.2e+246) (not (<= x 7.5e+258))) (* (log y) x) (+ (+ a t) (fma (- b 0.5) (log c) (fma i y z)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((x <= -1.2e+246) || !(x <= 7.5e+258)) {
tmp = log(y) * x;
} else {
tmp = (a + t) + fma((b - 0.5), log(c), fma(i, y, z));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((x <= -1.2e+246) || !(x <= 7.5e+258)) tmp = Float64(log(y) * x); else tmp = Float64(Float64(a + t) + fma(Float64(b - 0.5), log(c), fma(i, y, z))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[x, -1.2e+246], N[Not[LessEqual[x, 7.5e+258]], $MachinePrecision]], N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision], N[(N[(a + t), $MachinePrecision] + N[(N[(b - 0.5), $MachinePrecision] * N[Log[c], $MachinePrecision] + N[(i * y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.2 \cdot 10^{+246} \lor \neg \left(x \leq 7.5 \cdot 10^{+258}\right):\\
\;\;\;\;\log y \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(a + t\right) + \mathsf{fma}\left(b - 0.5, \log c, \mathsf{fma}\left(i, y, z\right)\right)\\
\end{array}
\end{array}
if x < -1.2e246 or 7.50000000000000032e258 < x Initial program 99.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6499.6
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.6
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.6
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.6
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.6
Applied rewrites99.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6475.9
Applied rewrites75.9%
if -1.2e246 < x < 7.50000000000000032e258Initial 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.f6490.0
Applied rewrites90.0%
Final simplification88.7%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= x -1.2e+246) (not (<= x 7.5e+258))) (* (log y) x) (+ (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.2e+246) || !(x <= 7.5e+258)) {
tmp = log(y) * x;
} 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.2e+246) || !(x <= 7.5e+258)) tmp = Float64(log(y) * x); 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[Or[LessEqual[x, -1.2e+246], N[Not[LessEqual[x, 7.5e+258]], $MachinePrecision]], N[(N[Log[y], $MachinePrecision] * x), $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.2 \cdot 10^{+246} \lor \neg \left(x \leq 7.5 \cdot 10^{+258}\right):\\
\;\;\;\;\log y \cdot x\\
\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.2e246 or 7.50000000000000032e258 < x Initial program 99.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6499.6
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.6
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.6
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.6
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.6
Applied rewrites99.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6475.9
Applied rewrites75.9%
if -1.2e246 < x < 7.50000000000000032e258Initial program 99.9%
Taylor expanded in t around 0
+-commutativeN/A
lower-+.f64N/A
Applied rewrites88.2%
Taylor expanded in x around 0
Applied rewrites78.4%
Final simplification78.2%
(FPCore (x y z t a b c i) :precision binary64 (if (<= z -4.5e+84) (+ (fma i y (fma -0.5 (log c) z)) a) (+ (fma i y (* (+ -0.5 b) (log c))) a)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (z <= -4.5e+84) {
tmp = fma(i, y, fma(-0.5, log(c), z)) + a;
} else {
tmp = fma(i, y, ((-0.5 + b) * log(c))) + a;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (z <= -4.5e+84) tmp = Float64(fma(i, y, fma(-0.5, log(c), z)) + a); else tmp = Float64(fma(i, y, Float64(Float64(-0.5 + b) * log(c))) + a); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[z, -4.5e+84], N[(N[(i * y + N[(-0.5 * N[Log[c], $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision], N[(N[(i * y + N[(N[(-0.5 + b), $MachinePrecision] * N[Log[c], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.5 \cdot 10^{+84}:\\
\;\;\;\;\mathsf{fma}\left(i, y, \mathsf{fma}\left(-0.5, \log c, z\right)\right) + a\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(i, y, \left(-0.5 + b\right) \cdot \log c\right) + a\\
\end{array}
\end{array}
if z < -4.4999999999999997e84Initial program 99.9%
Taylor expanded in t around 0
+-commutativeN/A
lower-+.f64N/A
Applied rewrites91.7%
Taylor expanded in x around 0
Applied rewrites85.3%
Taylor expanded in b around 0
Applied rewrites75.1%
if -4.4999999999999997e84 < z Initial program 99.9%
Taylor expanded in t around 0
+-commutativeN/A
lower-+.f64N/A
Applied rewrites88.7%
Taylor expanded in x around 0
Applied rewrites71.1%
Taylor expanded in z around 0
Applied rewrites58.4%
(FPCore (x y z t a b c i) :precision binary64 (if (<= y 1.65e-79) (* (/ 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.65e-79) {
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.65d-79) 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.65e-79) {
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.65e-79: 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.65e-79) 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.65e-79) 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.65e-79], N[(N[(a / i), $MachinePrecision] * i), $MachinePrecision], N[(i * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.65 \cdot 10^{-79}:\\
\;\;\;\;\frac{a}{i} \cdot i\\
\mathbf{else}:\\
\;\;\;\;i \cdot y\\
\end{array}
\end{array}
if y < 1.6499999999999999e-79Initial program 99.9%
Taylor expanded in i around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites68.4%
Taylor expanded in a around inf
Applied rewrites14.6%
if 1.6499999999999999e-79 < y Initial program 99.9%
Taylor expanded in y around inf
lower-*.f6437.4
Applied rewrites37.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.9%
Taylor expanded in y around inf
lower-*.f6424.4
Applied rewrites24.4%
herbie shell --seed 2024318
(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)))