
(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 15 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}
NOTE: z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (fma y i (fma (+ b -0.5) (log c) (+ (fma x (log y) z) (+ t a)))))
assert(z < t && 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((b + -0.5), log(c), (fma(x, log(y), z) + (t + a))));
}
z, t, a = sort([z, t, a]) function code(x, y, z, t, a, b, c, i) return fma(y, i, fma(Float64(b + -0.5), log(c), Float64(fma(x, log(y), z) + Float64(t + a)))) end
NOTE: z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(y * i + N[(N[(b + -0.5), $MachinePrecision] * N[Log[c], $MachinePrecision] + N[(N[(x * N[Log[y], $MachinePrecision] + z), $MachinePrecision] + N[(t + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[z, t, a] = \mathsf{sort}([z, t, a])\\
\\
\mathsf{fma}\left(y, i, \mathsf{fma}\left(b + -0.5, \log c, \mathsf{fma}\left(x, \log y, z\right) + \left(t + a\right)\right)\right)
\end{array}
Initial program 99.8%
+-commutative99.8%
fma-def99.9%
+-commutative99.9%
fma-def99.9%
sub-neg99.9%
metadata-eval99.9%
associate-+l+99.9%
fma-def99.9%
Simplified99.9%
Final simplification99.9%
NOTE: z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (+ (+ z (fma x (log y) t)) (fma y i (fma (+ b -0.5) (log c) a))))
assert(z < t && t < a);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (z + fma(x, log(y), t)) + fma(y, i, fma((b + -0.5), log(c), a));
}
z, t, a = sort([z, t, a]) function code(x, y, z, t, a, b, c, i) return Float64(Float64(z + fma(x, log(y), t)) + fma(y, i, fma(Float64(b + -0.5), log(c), a))) end
NOTE: z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(z + N[(x * N[Log[y], $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] + N[(y * i + N[(N[(b + -0.5), $MachinePrecision] * N[Log[c], $MachinePrecision] + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[z, t, a] = \mathsf{sort}([z, t, a])\\
\\
\left(z + \mathsf{fma}\left(x, \log y, t\right)\right) + \mathsf{fma}\left(y, i, \mathsf{fma}\left(b + -0.5, \log c, a\right)\right)
\end{array}
Initial program 99.8%
associate-+l+99.8%
associate-+l+99.8%
+-commutative99.8%
associate-+l+99.8%
fma-def99.8%
+-commutative99.8%
fma-def99.8%
+-commutative99.8%
fma-def99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Final simplification99.8%
NOTE: z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (+ (+ (fma x (log y) z) (+ t a)) (+ (* (+ b -0.5) (log c)) (* y i))))
assert(z < t && t < a);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (fma(x, log(y), z) + (t + a)) + (((b + -0.5) * log(c)) + (y * i));
}
z, t, a = sort([z, t, a]) function code(x, y, z, t, a, b, c, i) return Float64(Float64(fma(x, log(y), z) + Float64(t + a)) + Float64(Float64(Float64(b + -0.5) * log(c)) + Float64(y * i))) end
NOTE: z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(N[(x * N[Log[y], $MachinePrecision] + z), $MachinePrecision] + N[(t + a), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(b + -0.5), $MachinePrecision] * N[Log[c], $MachinePrecision]), $MachinePrecision] + N[(y * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[z, t, a] = \mathsf{sort}([z, t, a])\\
\\
\left(\mathsf{fma}\left(x, \log y, z\right) + \left(t + a\right)\right) + \left(\left(b + -0.5\right) \cdot \log c + y \cdot i\right)
\end{array}
Initial program 99.8%
associate-+l+99.8%
associate-+l+99.8%
fma-def99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Final simplification99.8%
NOTE: z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (if (or (<= x -6e+165) (not (<= x 5.3e+175))) (+ (* y i) (+ (* x (log y)) (+ a (+ t (* b (log c)))))) (fma y i (+ a (+ (* (log c) (- b 0.5)) (+ z t))))))
assert(z < t && t < a);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((x <= -6e+165) || !(x <= 5.3e+175)) {
tmp = (y * i) + ((x * log(y)) + (a + (t + (b * log(c)))));
} else {
tmp = fma(y, i, (a + ((log(c) * (b - 0.5)) + (z + t))));
}
return tmp;
}
z, t, a = sort([z, t, a]) function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((x <= -6e+165) || !(x <= 5.3e+175)) tmp = Float64(Float64(y * i) + Float64(Float64(x * log(y)) + Float64(a + Float64(t + Float64(b * log(c)))))); else tmp = fma(y, i, Float64(a + Float64(Float64(log(c) * Float64(b - 0.5)) + Float64(z + t)))); end return tmp end
NOTE: z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[x, -6e+165], N[Not[LessEqual[x, 5.3e+175]], $MachinePrecision]], N[(N[(y * i), $MachinePrecision] + N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(a + N[(t + N[(b * N[Log[c], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * i + N[(a + N[(N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision]), $MachinePrecision] + N[(z + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t, a] = \mathsf{sort}([z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6 \cdot 10^{+165} \lor \neg \left(x \leq 5.3 \cdot 10^{+175}\right):\\
\;\;\;\;y \cdot i + \left(x \cdot \log y + \left(a + \left(t + b \cdot \log c\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, i, a + \left(\log c \cdot \left(b - 0.5\right) + \left(z + t\right)\right)\right)\\
\end{array}
\end{array}
if x < -5.99999999999999981e165 or 5.30000000000000012e175 < x Initial program 99.6%
associate-+l+99.6%
associate-+l+99.6%
+-commutative99.6%
associate-+l+99.6%
fma-def99.6%
+-commutative99.6%
fma-def99.6%
+-commutative99.6%
fma-def99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in z around 0 90.4%
Taylor expanded in b around inf 90.4%
if -5.99999999999999981e165 < x < 5.30000000000000012e175Initial program 99.9%
+-commutative99.9%
fma-def99.9%
+-commutative99.9%
fma-def99.9%
sub-neg99.9%
metadata-eval99.9%
associate-+l+99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in x around 0 95.8%
Final simplification94.4%
NOTE: z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (+ (* y i) (+ (+ a (+ t (+ z (* x (log y))))) (* (log c) (- b 0.5)))))
assert(z < t && t < a);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (y * i) + ((a + (t + (z + (x * log(y))))) + (log(c) * (b - 0.5)));
}
NOTE: z, t, and a should be sorted in increasing order before calling this function.
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 = (y * i) + ((a + (t + (z + (x * log(y))))) + (log(c) * (b - 0.5d0)))
end function
assert z < t && t < a;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (y * i) + ((a + (t + (z + (x * Math.log(y))))) + (Math.log(c) * (b - 0.5)));
}
[z, t, a] = sort([z, t, a]) def code(x, y, z, t, a, b, c, i): return (y * i) + ((a + (t + (z + (x * math.log(y))))) + (math.log(c) * (b - 0.5)))
z, t, a = sort([z, t, a]) function code(x, y, z, t, a, b, c, i) return Float64(Float64(y * i) + Float64(Float64(a + Float64(t + Float64(z + Float64(x * log(y))))) + Float64(log(c) * Float64(b - 0.5)))) end
z, t, a = num2cell(sort([z, t, a])){:}
function tmp = code(x, y, z, t, a, b, c, i)
tmp = (y * i) + ((a + (t + (z + (x * log(y))))) + (log(c) * (b - 0.5)));
end
NOTE: z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(y * i), $MachinePrecision] + N[(N[(a + N[(t + N[(z + N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[z, t, a] = \mathsf{sort}([z, t, a])\\
\\
y \cdot i + \left(\left(a + \left(t + \left(z + x \cdot \log y\right)\right)\right) + \log c \cdot \left(b - 0.5\right)\right)
\end{array}
Initial program 99.8%
Final simplification99.8%
NOTE: z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (if (or (<= x -1.25e+167) (not (<= x 9.4e+163))) (+ (* y i) (+ (* x (log y)) (+ a (* b (log c))))) (+ (* y i) (+ (* (log c) (- b 0.5)) (+ t (+ z a))))))
assert(z < t && 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.25e+167) || !(x <= 9.4e+163)) {
tmp = (y * i) + ((x * log(y)) + (a + (b * log(c))));
} else {
tmp = (y * i) + ((log(c) * (b - 0.5)) + (t + (z + a)));
}
return tmp;
}
NOTE: z, t, and a should be sorted in increasing order before calling this function.
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 ((x <= (-1.25d+167)) .or. (.not. (x <= 9.4d+163))) then
tmp = (y * i) + ((x * log(y)) + (a + (b * log(c))))
else
tmp = (y * i) + ((log(c) * (b - 0.5d0)) + (t + (z + a)))
end if
code = tmp
end function
assert z < t && t < a;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((x <= -1.25e+167) || !(x <= 9.4e+163)) {
tmp = (y * i) + ((x * Math.log(y)) + (a + (b * Math.log(c))));
} else {
tmp = (y * i) + ((Math.log(c) * (b - 0.5)) + (t + (z + a)));
}
return tmp;
}
[z, t, a] = sort([z, t, a]) def code(x, y, z, t, a, b, c, i): tmp = 0 if (x <= -1.25e+167) or not (x <= 9.4e+163): tmp = (y * i) + ((x * math.log(y)) + (a + (b * math.log(c)))) else: tmp = (y * i) + ((math.log(c) * (b - 0.5)) + (t + (z + a))) return tmp
z, t, a = sort([z, t, a]) function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((x <= -1.25e+167) || !(x <= 9.4e+163)) tmp = Float64(Float64(y * i) + Float64(Float64(x * log(y)) + Float64(a + Float64(b * log(c))))); else tmp = Float64(Float64(y * i) + Float64(Float64(log(c) * Float64(b - 0.5)) + Float64(t + Float64(z + a)))); end return tmp end
z, t, a = num2cell(sort([z, t, a])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
tmp = 0.0;
if ((x <= -1.25e+167) || ~((x <= 9.4e+163)))
tmp = (y * i) + ((x * log(y)) + (a + (b * log(c))));
else
tmp = (y * i) + ((log(c) * (b - 0.5)) + (t + (z + a)));
end
tmp_2 = tmp;
end
NOTE: z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[x, -1.25e+167], N[Not[LessEqual[x, 9.4e+163]], $MachinePrecision]], N[(N[(y * i), $MachinePrecision] + N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(a + N[(b * N[Log[c], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * i), $MachinePrecision] + N[(N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision]), $MachinePrecision] + N[(t + N[(z + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t, a] = \mathsf{sort}([z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.25 \cdot 10^{+167} \lor \neg \left(x \leq 9.4 \cdot 10^{+163}\right):\\
\;\;\;\;y \cdot i + \left(x \cdot \log y + \left(a + b \cdot \log c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot i + \left(\log c \cdot \left(b - 0.5\right) + \left(t + \left(z + a\right)\right)\right)\\
\end{array}
\end{array}
if x < -1.2499999999999999e167 or 9.40000000000000037e163 < x Initial program 99.6%
associate-+l+99.6%
associate-+l+99.6%
+-commutative99.6%
associate-+l+99.6%
fma-def99.6%
+-commutative99.6%
fma-def99.6%
+-commutative99.6%
fma-def99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in z around 0 90.4%
Taylor expanded in b around inf 90.4%
Taylor expanded in t around 0 89.5%
+-commutative89.5%
*-commutative89.5%
Simplified89.5%
if -1.2499999999999999e167 < x < 9.40000000000000037e163Initial program 99.9%
Taylor expanded in x around 0 95.7%
+-commutative95.7%
associate-+l+95.7%
+-commutative95.7%
Simplified95.7%
Final simplification94.2%
NOTE: z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (if (or (<= x -3.2e+167) (not (<= x 1.65e+171))) (+ (* y i) (+ (* x (log y)) (+ a (* b (log c))))) (fma y i (+ a (+ (* (log c) (- b 0.5)) (+ z t))))))
assert(z < t && t < a);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((x <= -3.2e+167) || !(x <= 1.65e+171)) {
tmp = (y * i) + ((x * log(y)) + (a + (b * log(c))));
} else {
tmp = fma(y, i, (a + ((log(c) * (b - 0.5)) + (z + t))));
}
return tmp;
}
z, t, a = sort([z, t, a]) function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((x <= -3.2e+167) || !(x <= 1.65e+171)) tmp = Float64(Float64(y * i) + Float64(Float64(x * log(y)) + Float64(a + Float64(b * log(c))))); else tmp = fma(y, i, Float64(a + Float64(Float64(log(c) * Float64(b - 0.5)) + Float64(z + t)))); end return tmp end
NOTE: z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[x, -3.2e+167], N[Not[LessEqual[x, 1.65e+171]], $MachinePrecision]], N[(N[(y * i), $MachinePrecision] + N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(a + N[(b * N[Log[c], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * i + N[(a + N[(N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision]), $MachinePrecision] + N[(z + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t, a] = \mathsf{sort}([z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.2 \cdot 10^{+167} \lor \neg \left(x \leq 1.65 \cdot 10^{+171}\right):\\
\;\;\;\;y \cdot i + \left(x \cdot \log y + \left(a + b \cdot \log c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, i, a + \left(\log c \cdot \left(b - 0.5\right) + \left(z + t\right)\right)\right)\\
\end{array}
\end{array}
if x < -3.19999999999999981e167 or 1.64999999999999996e171 < x Initial program 99.6%
associate-+l+99.6%
associate-+l+99.6%
+-commutative99.6%
associate-+l+99.6%
fma-def99.6%
+-commutative99.6%
fma-def99.6%
+-commutative99.6%
fma-def99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in z around 0 90.4%
Taylor expanded in b around inf 90.4%
Taylor expanded in t around 0 89.5%
+-commutative89.5%
*-commutative89.5%
Simplified89.5%
if -3.19999999999999981e167 < x < 1.64999999999999996e171Initial program 99.9%
+-commutative99.9%
fma-def99.9%
+-commutative99.9%
fma-def99.9%
sub-neg99.9%
metadata-eval99.9%
associate-+l+99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in x around 0 95.8%
Final simplification94.2%
NOTE: z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (if (or (<= x -1.55e+211) (not (<= x 1.75e+186))) (+ (* y i) (+ (+ t a) (* x (log y)))) (+ (* y i) (+ (* (log c) (- b 0.5)) (+ t (+ z a))))))
assert(z < t && 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.55e+211) || !(x <= 1.75e+186)) {
tmp = (y * i) + ((t + a) + (x * log(y)));
} else {
tmp = (y * i) + ((log(c) * (b - 0.5)) + (t + (z + a)));
}
return tmp;
}
NOTE: z, t, and a should be sorted in increasing order before calling this function.
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 ((x <= (-1.55d+211)) .or. (.not. (x <= 1.75d+186))) then
tmp = (y * i) + ((t + a) + (x * log(y)))
else
tmp = (y * i) + ((log(c) * (b - 0.5d0)) + (t + (z + a)))
end if
code = tmp
end function
assert z < t && t < a;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((x <= -1.55e+211) || !(x <= 1.75e+186)) {
tmp = (y * i) + ((t + a) + (x * Math.log(y)));
} else {
tmp = (y * i) + ((Math.log(c) * (b - 0.5)) + (t + (z + a)));
}
return tmp;
}
[z, t, a] = sort([z, t, a]) def code(x, y, z, t, a, b, c, i): tmp = 0 if (x <= -1.55e+211) or not (x <= 1.75e+186): tmp = (y * i) + ((t + a) + (x * math.log(y))) else: tmp = (y * i) + ((math.log(c) * (b - 0.5)) + (t + (z + a))) return tmp
z, t, a = sort([z, t, a]) function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((x <= -1.55e+211) || !(x <= 1.75e+186)) tmp = Float64(Float64(y * i) + Float64(Float64(t + a) + Float64(x * log(y)))); else tmp = Float64(Float64(y * i) + Float64(Float64(log(c) * Float64(b - 0.5)) + Float64(t + Float64(z + a)))); end return tmp end
z, t, a = num2cell(sort([z, t, a])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
tmp = 0.0;
if ((x <= -1.55e+211) || ~((x <= 1.75e+186)))
tmp = (y * i) + ((t + a) + (x * log(y)));
else
tmp = (y * i) + ((log(c) * (b - 0.5)) + (t + (z + a)));
end
tmp_2 = tmp;
end
NOTE: z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[x, -1.55e+211], N[Not[LessEqual[x, 1.75e+186]], $MachinePrecision]], N[(N[(y * i), $MachinePrecision] + N[(N[(t + a), $MachinePrecision] + N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * i), $MachinePrecision] + N[(N[(N[Log[c], $MachinePrecision] * N[(b - 0.5), $MachinePrecision]), $MachinePrecision] + N[(t + N[(z + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t, a] = \mathsf{sort}([z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.55 \cdot 10^{+211} \lor \neg \left(x \leq 1.75 \cdot 10^{+186}\right):\\
\;\;\;\;y \cdot i + \left(\left(t + a\right) + x \cdot \log y\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot i + \left(\log c \cdot \left(b - 0.5\right) + \left(t + \left(z + a\right)\right)\right)\\
\end{array}
\end{array}
if x < -1.5500000000000001e211 or 1.74999999999999993e186 < x Initial program 99.6%
associate-+l+99.6%
associate-+l+99.6%
+-commutative99.6%
associate-+l+99.6%
fma-def99.6%
+-commutative99.6%
fma-def99.6%
+-commutative99.6%
fma-def99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in z around 0 91.0%
Taylor expanded in b around inf 91.0%
Taylor expanded in b around 0 81.6%
+-commutative81.6%
Simplified81.6%
if -1.5500000000000001e211 < x < 1.74999999999999993e186Initial program 99.9%
Taylor expanded in x around 0 95.4%
+-commutative95.4%
associate-+l+95.4%
+-commutative95.4%
Simplified95.4%
Final simplification92.4%
NOTE: z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (if (or (<= x -2.4e+168) (not (<= x 1.42e+184))) (+ (* y i) (+ (+ t a) (* x (log y)))) (fma y i (+ z (+ t a)))))
assert(z < t && t < a);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((x <= -2.4e+168) || !(x <= 1.42e+184)) {
tmp = (y * i) + ((t + a) + (x * log(y)));
} else {
tmp = fma(y, i, (z + (t + a)));
}
return tmp;
}
z, t, a = sort([z, t, a]) function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((x <= -2.4e+168) || !(x <= 1.42e+184)) tmp = Float64(Float64(y * i) + Float64(Float64(t + a) + Float64(x * log(y)))); else tmp = fma(y, i, Float64(z + Float64(t + a))); end return tmp end
NOTE: z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[x, -2.4e+168], N[Not[LessEqual[x, 1.42e+184]], $MachinePrecision]], N[(N[(y * i), $MachinePrecision] + N[(N[(t + a), $MachinePrecision] + N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * i + N[(z + N[(t + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t, a] = \mathsf{sort}([z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.4 \cdot 10^{+168} \lor \neg \left(x \leq 1.42 \cdot 10^{+184}\right):\\
\;\;\;\;y \cdot i + \left(\left(t + a\right) + x \cdot \log y\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, i, z + \left(t + a\right)\right)\\
\end{array}
\end{array}
if x < -2.40000000000000009e168 or 1.42000000000000002e184 < x Initial program 99.6%
associate-+l+99.6%
associate-+l+99.6%
+-commutative99.6%
associate-+l+99.6%
fma-def99.6%
+-commutative99.6%
fma-def99.6%
+-commutative99.6%
fma-def99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in z around 0 90.2%
Taylor expanded in b around inf 90.2%
Taylor expanded in b around 0 78.6%
+-commutative78.6%
Simplified78.6%
if -2.40000000000000009e168 < x < 1.42000000000000002e184Initial program 99.9%
+-commutative99.9%
fma-def99.9%
+-commutative99.9%
fma-def99.9%
sub-neg99.9%
metadata-eval99.9%
associate-+l+99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in x around 0 95.8%
Taylor expanded in b around inf 94.0%
Taylor expanded in b around 0 78.1%
+-commutative78.1%
+-commutative78.1%
associate-+l+78.1%
Simplified78.1%
Final simplification78.2%
NOTE: z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (fma y i (+ z (+ t a))))
assert(z < t && t < a);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return fma(y, i, (z + (t + a)));
}
z, t, a = sort([z, t, a]) function code(x, y, z, t, a, b, c, i) return fma(y, i, Float64(z + Float64(t + a))) end
NOTE: z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(y * i + N[(z + N[(t + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[z, t, a] = \mathsf{sort}([z, t, a])\\
\\
\mathsf{fma}\left(y, i, z + \left(t + a\right)\right)
\end{array}
Initial program 99.8%
+-commutative99.8%
fma-def99.9%
+-commutative99.9%
fma-def99.9%
sub-neg99.9%
metadata-eval99.9%
associate-+l+99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in x around 0 81.9%
Taylor expanded in b around inf 80.5%
Taylor expanded in b around 0 66.0%
+-commutative66.0%
+-commutative66.0%
associate-+l+66.0%
Simplified66.0%
Final simplification66.0%
NOTE: z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (fma y i (+ t a)))
assert(z < t && t < a);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return fma(y, i, (t + a));
}
z, t, a = sort([z, t, a]) function code(x, y, z, t, a, b, c, i) return fma(y, i, Float64(t + a)) end
NOTE: z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(y * i + N[(t + a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[z, t, a] = \mathsf{sort}([z, t, a])\\
\\
\mathsf{fma}\left(y, i, t + a\right)
\end{array}
Initial program 99.8%
+-commutative99.8%
fma-def99.9%
+-commutative99.9%
fma-def99.9%
sub-neg99.9%
metadata-eval99.9%
associate-+l+99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in x around 0 81.9%
Taylor expanded in b around inf 80.5%
add-sqr-sqrt41.5%
pow241.5%
Applied egg-rr41.5%
Taylor expanded in t around inf 52.9%
Final simplification52.9%
NOTE: z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (fma y i (+ z a)))
assert(z < t && t < a);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return fma(y, i, (z + a));
}
z, t, a = sort([z, t, a]) function code(x, y, z, t, a, b, c, i) return fma(y, i, Float64(z + a)) end
NOTE: z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(y * i + N[(z + a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[z, t, a] = \mathsf{sort}([z, t, a])\\
\\
\mathsf{fma}\left(y, i, z + a\right)
\end{array}
Initial program 99.8%
+-commutative99.8%
fma-def99.9%
+-commutative99.9%
fma-def99.9%
sub-neg99.9%
metadata-eval99.9%
associate-+l+99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in x around 0 81.9%
Taylor expanded in b around inf 80.5%
add-sqr-sqrt41.5%
pow241.5%
Applied egg-rr41.5%
Taylor expanded in z around inf 51.5%
Final simplification51.5%
NOTE: z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (fma y i a))
assert(z < t && t < a);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return fma(y, i, a);
}
z, t, a = sort([z, t, a]) function code(x, y, z, t, a, b, c, i) return fma(y, i, a) end
NOTE: z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(y * i + a), $MachinePrecision]
\begin{array}{l}
[z, t, a] = \mathsf{sort}([z, t, a])\\
\\
\mathsf{fma}\left(y, i, a\right)
\end{array}
Initial program 99.8%
+-commutative99.8%
fma-def99.9%
+-commutative99.9%
fma-def99.9%
sub-neg99.9%
metadata-eval99.9%
associate-+l+99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in x around 0 81.9%
Taylor expanded in a around inf 38.6%
Final simplification38.6%
NOTE: z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (if (<= y 5.4e-30) a (* y i)))
assert(z < t && t < a);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (y <= 5.4e-30) {
tmp = a;
} else {
tmp = y * i;
}
return tmp;
}
NOTE: z, t, and a should be sorted in increasing order before calling this function.
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 <= 5.4d-30) then
tmp = a
else
tmp = y * i
end if
code = tmp
end function
assert z < t && t < a;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (y <= 5.4e-30) {
tmp = a;
} else {
tmp = y * i;
}
return tmp;
}
[z, t, a] = sort([z, t, a]) def code(x, y, z, t, a, b, c, i): tmp = 0 if y <= 5.4e-30: tmp = a else: tmp = y * i return tmp
z, t, a = sort([z, t, a]) function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (y <= 5.4e-30) tmp = a; else tmp = Float64(y * i); end return tmp end
z, t, a = num2cell(sort([z, t, a])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
tmp = 0.0;
if (y <= 5.4e-30)
tmp = a;
else
tmp = y * i;
end
tmp_2 = tmp;
end
NOTE: z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[y, 5.4e-30], a, N[(y * i), $MachinePrecision]]
\begin{array}{l}
[z, t, a] = \mathsf{sort}([z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.4 \cdot 10^{-30}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;y \cdot i\\
\end{array}
\end{array}
if y < 5.39999999999999975e-30Initial program 99.8%
associate-+l+99.8%
associate-+l+99.8%
fma-def99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
add-cube-cbrt99.2%
Applied egg-rr99.2%
add-cube-cbrt99.8%
add-sqr-sqrt56.3%
pow256.3%
Applied egg-rr56.3%
Taylor expanded in a around inf 21.9%
if 5.39999999999999975e-30 < y Initial program 99.9%
associate-+l+99.9%
associate-+l+99.9%
+-commutative99.9%
associate-+l+99.9%
fma-def99.9%
+-commutative99.9%
fma-def99.9%
+-commutative99.9%
fma-def99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf 42.0%
*-commutative42.0%
Simplified42.0%
Final simplification32.4%
NOTE: z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 a)
assert(z < t && t < a);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return a;
}
NOTE: z, t, and a should be sorted in increasing order before calling this function.
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 = a
end function
assert z < t && t < a;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return a;
}
[z, t, a] = sort([z, t, a]) def code(x, y, z, t, a, b, c, i): return a
z, t, a = sort([z, t, a]) function code(x, y, z, t, a, b, c, i) return a end
z, t, a = num2cell(sort([z, t, a])){:}
function tmp = code(x, y, z, t, a, b, c, i)
tmp = a;
end
NOTE: z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := a
\begin{array}{l}
[z, t, a] = \mathsf{sort}([z, t, a])\\
\\
a
\end{array}
Initial program 99.8%
associate-+l+99.8%
associate-+l+99.8%
fma-def99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
add-cube-cbrt99.4%
Applied egg-rr99.4%
add-cube-cbrt99.8%
add-sqr-sqrt56.5%
pow256.5%
Applied egg-rr56.5%
Taylor expanded in a around inf 16.7%
Final simplification16.7%
herbie shell --seed 2023199
(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)))