
(FPCore (x y z t a b) :precision binary64 (+ (- (+ (+ x y) z) (* z (log t))) (* (- a 0.5) b)))
double code(double x, double y, double z, double t, double a, double b) {
return (((x + y) + z) - (z * log(t))) + ((a - 0.5) * b);
}
real(8) function code(x, y, z, t, a, b)
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
code = (((x + y) + z) - (z * log(t))) + ((a - 0.5d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return (((x + y) + z) - (z * Math.log(t))) + ((a - 0.5) * b);
}
def code(x, y, z, t, a, b): return (((x + y) + z) - (z * math.log(t))) + ((a - 0.5) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(Float64(x + y) + z) - Float64(z * log(t))) + Float64(Float64(a - 0.5) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = (((x + y) + z) - (z * log(t))) + ((a - 0.5) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(N[(x + y), $MachinePrecision] + z), $MachinePrecision] - N[(z * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (+ (- (+ (+ x y) z) (* z (log t))) (* (- a 0.5) b)))
double code(double x, double y, double z, double t, double a, double b) {
return (((x + y) + z) - (z * log(t))) + ((a - 0.5) * b);
}
real(8) function code(x, y, z, t, a, b)
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
code = (((x + y) + z) - (z * log(t))) + ((a - 0.5d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return (((x + y) + z) - (z * Math.log(t))) + ((a - 0.5) * b);
}
def code(x, y, z, t, a, b): return (((x + y) + z) - (z * math.log(t))) + ((a - 0.5) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(Float64(x + y) + z) - Float64(z * log(t))) + Float64(Float64(a - 0.5) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = (((x + y) + z) - (z * log(t))) + ((a - 0.5) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(N[(x + y), $MachinePrecision] + z), $MachinePrecision] - N[(z * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b
\end{array}
(FPCore (x y z t a b) :precision binary64 (+ (* b (- a 0.5)) (- (+ z (+ y x)) (* (log t) z))))
double code(double x, double y, double z, double t, double a, double b) {
return (b * (a - 0.5)) + ((z + (y + x)) - (log(t) * z));
}
real(8) function code(x, y, z, t, a, b)
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
code = (b * (a - 0.5d0)) + ((z + (y + x)) - (log(t) * z))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return (b * (a - 0.5)) + ((z + (y + x)) - (Math.log(t) * z));
}
def code(x, y, z, t, a, b): return (b * (a - 0.5)) + ((z + (y + x)) - (math.log(t) * z))
function code(x, y, z, t, a, b) return Float64(Float64(b * Float64(a - 0.5)) + Float64(Float64(z + Float64(y + x)) - Float64(log(t) * z))) end
function tmp = code(x, y, z, t, a, b) tmp = (b * (a - 0.5)) + ((z + (y + x)) - (log(t) * z)); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(b * N[(a - 0.5), $MachinePrecision]), $MachinePrecision] + N[(N[(z + N[(y + x), $MachinePrecision]), $MachinePrecision] - N[(N[Log[t], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
b \cdot \left(a - 0.5\right) + \left(\left(z + \left(y + x\right)\right) - \log t \cdot z\right)
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* b (- a 0.5))))
(if (<= t_1 -2e+61)
(- (+ z (+ y x)) (* (- 0.5 a) b))
(if (<= t_1 5e+100)
(+ (fma (- 1.0 (log t)) z (fma -0.5 b x)) y)
(fma (- a 0.5) b (+ y x))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = b * (a - 0.5);
double tmp;
if (t_1 <= -2e+61) {
tmp = (z + (y + x)) - ((0.5 - a) * b);
} else if (t_1 <= 5e+100) {
tmp = fma((1.0 - log(t)), z, fma(-0.5, b, x)) + y;
} else {
tmp = fma((a - 0.5), b, (y + x));
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(b * Float64(a - 0.5)) tmp = 0.0 if (t_1 <= -2e+61) tmp = Float64(Float64(z + Float64(y + x)) - Float64(Float64(0.5 - a) * b)); elseif (t_1 <= 5e+100) tmp = Float64(fma(Float64(1.0 - log(t)), z, fma(-0.5, b, x)) + y); else tmp = fma(Float64(a - 0.5), b, Float64(y + x)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(b * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+61], N[(N[(z + N[(y + x), $MachinePrecision]), $MachinePrecision] - N[(N[(0.5 - a), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+100], N[(N[(N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision] * z + N[(-0.5 * b + x), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision], N[(N[(a - 0.5), $MachinePrecision] * b + N[(y + x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := b \cdot \left(a - 0.5\right)\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+61}:\\
\;\;\;\;\left(z + \left(y + x\right)\right) - \left(0.5 - a\right) \cdot b\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+100}:\\
\;\;\;\;\mathsf{fma}\left(1 - \log t, z, \mathsf{fma}\left(-0.5, b, x\right)\right) + y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, y + x\right)\\
\end{array}
\end{array}
if (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < -1.9999999999999999e61Initial program 99.9%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lower--.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower--.f6499.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.9
Applied rewrites99.9%
Taylor expanded in z around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
distribute-lft-inN/A
metadata-evalN/A
+-commutativeN/A
neg-mul-1N/A
sub-negN/A
lower--.f6488.0
Applied rewrites88.0%
if -1.9999999999999999e61 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < 4.9999999999999999e100Initial program 99.8%
Taylor expanded in a around 0
*-commutativeN/A
cancel-sign-sub-invN/A
log-recN/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
associate-+r+N/A
associate-+l+N/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
log-recN/A
cancel-sign-sub-invN/A
*-commutativeN/A
lower-+.f64N/A
Applied rewrites97.8%
Applied rewrites97.8%
if 4.9999999999999999e100 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) Initial program 100.0%
Taylor expanded in z around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f6491.5
Applied rewrites91.5%
Final simplification94.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* b (- a 0.5))))
(if (<= t_1 -5e+20)
(- (+ z (+ y x)) (* (- 0.5 a) b))
(if (<= t_1 5e+100)
(fma (- 1.0 (log t)) z (+ y x))
(fma (- a 0.5) b (+ y x))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = b * (a - 0.5);
double tmp;
if (t_1 <= -5e+20) {
tmp = (z + (y + x)) - ((0.5 - a) * b);
} else if (t_1 <= 5e+100) {
tmp = fma((1.0 - log(t)), z, (y + x));
} else {
tmp = fma((a - 0.5), b, (y + x));
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(b * Float64(a - 0.5)) tmp = 0.0 if (t_1 <= -5e+20) tmp = Float64(Float64(z + Float64(y + x)) - Float64(Float64(0.5 - a) * b)); elseif (t_1 <= 5e+100) tmp = fma(Float64(1.0 - log(t)), z, Float64(y + x)); else tmp = fma(Float64(a - 0.5), b, Float64(y + x)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(b * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+20], N[(N[(z + N[(y + x), $MachinePrecision]), $MachinePrecision] - N[(N[(0.5 - a), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+100], N[(N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision] * z + N[(y + x), $MachinePrecision]), $MachinePrecision], N[(N[(a - 0.5), $MachinePrecision] * b + N[(y + x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := b \cdot \left(a - 0.5\right)\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+20}:\\
\;\;\;\;\left(z + \left(y + x\right)\right) - \left(0.5 - a\right) \cdot b\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+100}:\\
\;\;\;\;\mathsf{fma}\left(1 - \log t, z, y + x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, y + x\right)\\
\end{array}
\end{array}
if (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < -5e20Initial program 99.9%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lower--.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower--.f6499.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.9
Applied rewrites99.9%
Taylor expanded in z around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
distribute-lft-inN/A
metadata-evalN/A
+-commutativeN/A
neg-mul-1N/A
sub-negN/A
lower--.f6485.6
Applied rewrites85.6%
if -5e20 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < 4.9999999999999999e100Initial program 99.8%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lower--.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower--.f6499.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.8
Applied rewrites99.8%
Taylor expanded in b around 0
associate-+r+N/A
associate--l+N/A
unsub-negN/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
distribute-lft-neg-inN/A
*-lft-identityN/A
log-recN/A
distribute-rgt-inN/A
log-recN/A
sub-negN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f6496.5
Applied rewrites96.5%
if 4.9999999999999999e100 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) Initial program 100.0%
Taylor expanded in z around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f6491.5
Applied rewrites91.5%
Final simplification92.4%
(FPCore (x y z t a b) :precision binary64 (if (<= (+ y x) -2e-221) (fma (- 1.0 (log t)) z (fma (- a 0.5) b x)) (+ (- (+ z y) (* (log t) z)) (* b (- a 0.5)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y + x) <= -2e-221) {
tmp = fma((1.0 - log(t)), z, fma((a - 0.5), b, x));
} else {
tmp = ((z + y) - (log(t) * z)) + (b * (a - 0.5));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(y + x) <= -2e-221) tmp = fma(Float64(1.0 - log(t)), z, fma(Float64(a - 0.5), b, x)); else tmp = Float64(Float64(Float64(z + y) - Float64(log(t) * z)) + Float64(b * Float64(a - 0.5))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(y + x), $MachinePrecision], -2e-221], N[(N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision] * z + N[(N[(a - 0.5), $MachinePrecision] * b + x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z + y), $MachinePrecision] - N[(N[Log[t], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] + N[(b * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y + x \leq -2 \cdot 10^{-221}:\\
\;\;\;\;\mathsf{fma}\left(1 - \log t, z, \mathsf{fma}\left(a - 0.5, b, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(z + y\right) - \log t \cdot z\right) + b \cdot \left(a - 0.5\right)\\
\end{array}
\end{array}
if (+.f64 x y) < -2.00000000000000003e-221Initial program 99.9%
Taylor expanded in y around 0
*-commutativeN/A
cancel-sign-sub-invN/A
log-recN/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
associate-+l+N/A
associate-+r+N/A
*-commutativeN/A
distribute-lft1-inN/A
+-commutativeN/A
log-recN/A
mul-1-negN/A
lower-fma.f64N/A
Applied rewrites83.5%
if -2.00000000000000003e-221 < (+.f64 x y) Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
lower-+.f6473.8
Applied rewrites73.8%
Final simplification78.7%
(FPCore (x y z t a b) :precision binary64 (if (<= y 4.5e+84) (fma (- 1.0 (log t)) z (fma (- a 0.5) b x)) (- (+ z (+ y x)) (* (- 0.5 a) b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= 4.5e+84) {
tmp = fma((1.0 - log(t)), z, fma((a - 0.5), b, x));
} else {
tmp = (z + (y + x)) - ((0.5 - a) * b);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= 4.5e+84) tmp = fma(Float64(1.0 - log(t)), z, fma(Float64(a - 0.5), b, x)); else tmp = Float64(Float64(z + Float64(y + x)) - Float64(Float64(0.5 - a) * b)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, 4.5e+84], N[(N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision] * z + N[(N[(a - 0.5), $MachinePrecision] * b + x), $MachinePrecision]), $MachinePrecision], N[(N[(z + N[(y + x), $MachinePrecision]), $MachinePrecision] - N[(N[(0.5 - a), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.5 \cdot 10^{+84}:\\
\;\;\;\;\mathsf{fma}\left(1 - \log t, z, \mathsf{fma}\left(a - 0.5, b, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(z + \left(y + x\right)\right) - \left(0.5 - a\right) \cdot b\\
\end{array}
\end{array}
if y < 4.4999999999999997e84Initial program 99.8%
Taylor expanded in y around 0
*-commutativeN/A
cancel-sign-sub-invN/A
log-recN/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
associate-+l+N/A
associate-+r+N/A
*-commutativeN/A
distribute-lft1-inN/A
+-commutativeN/A
log-recN/A
mul-1-negN/A
lower-fma.f64N/A
Applied rewrites89.1%
if 4.4999999999999997e84 < y Initial program 100.0%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lower--.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower--.f64100.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f64100.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f64100.0
Applied rewrites100.0%
Taylor expanded in z around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
distribute-lft-inN/A
metadata-evalN/A
+-commutativeN/A
neg-mul-1N/A
sub-negN/A
lower--.f6496.6
Applied rewrites96.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (- 1.0 (log t))))
(if (<= z -5.8e+154)
(fma t_1 z y)
(if (<= z 1.25e+279) (- (+ z (+ y x)) (* (- 0.5 a) b)) (* t_1 z)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = 1.0 - log(t);
double tmp;
if (z <= -5.8e+154) {
tmp = fma(t_1, z, y);
} else if (z <= 1.25e+279) {
tmp = (z + (y + x)) - ((0.5 - a) * b);
} else {
tmp = t_1 * z;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(1.0 - log(t)) tmp = 0.0 if (z <= -5.8e+154) tmp = fma(t_1, z, y); elseif (z <= 1.25e+279) tmp = Float64(Float64(z + Float64(y + x)) - Float64(Float64(0.5 - a) * b)); else tmp = Float64(t_1 * z); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5.8e+154], N[(t$95$1 * z + y), $MachinePrecision], If[LessEqual[z, 1.25e+279], N[(N[(z + N[(y + x), $MachinePrecision]), $MachinePrecision] - N[(N[(0.5 - a), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 1 - \log t\\
\mathbf{if}\;z \leq -5.8 \cdot 10^{+154}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, z, y\right)\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{+279}:\\
\;\;\;\;\left(z + \left(y + x\right)\right) - \left(0.5 - a\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot z\\
\end{array}
\end{array}
if z < -5.79999999999999959e154Initial program 99.6%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lower--.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower--.f6499.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.6
Applied rewrites99.6%
Taylor expanded in b around 0
associate-+r+N/A
associate--l+N/A
unsub-negN/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
distribute-lft-neg-inN/A
*-lft-identityN/A
log-recN/A
distribute-rgt-inN/A
log-recN/A
sub-negN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f6485.8
Applied rewrites85.8%
Taylor expanded in x around 0
Applied rewrites81.3%
if -5.79999999999999959e154 < z < 1.25e279Initial program 99.9%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lower--.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower--.f6499.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.9
Applied rewrites99.9%
Taylor expanded in z around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
distribute-lft-inN/A
metadata-evalN/A
+-commutativeN/A
neg-mul-1N/A
sub-negN/A
lower--.f6486.6
Applied rewrites86.6%
if 1.25e279 < z Initial program 99.8%
Taylor expanded in z around inf
*-commutativeN/A
sub-negN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
sub-negN/A
lower--.f64N/A
lower-log.f6477.7
Applied rewrites77.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- 1.0 (log t)) z)))
(if (<= z -4.8e+156)
t_1
(if (<= z 1.25e+279) (- (+ z (+ y x)) (* (- 0.5 a) b)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (1.0 - log(t)) * z;
double tmp;
if (z <= -4.8e+156) {
tmp = t_1;
} else if (z <= 1.25e+279) {
tmp = (z + (y + x)) - ((0.5 - a) * b);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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) :: t_1
real(8) :: tmp
t_1 = (1.0d0 - log(t)) * z
if (z <= (-4.8d+156)) then
tmp = t_1
else if (z <= 1.25d+279) then
tmp = (z + (y + x)) - ((0.5d0 - a) * b)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (1.0 - Math.log(t)) * z;
double tmp;
if (z <= -4.8e+156) {
tmp = t_1;
} else if (z <= 1.25e+279) {
tmp = (z + (y + x)) - ((0.5 - a) * b);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (1.0 - math.log(t)) * z tmp = 0 if z <= -4.8e+156: tmp = t_1 elif z <= 1.25e+279: tmp = (z + (y + x)) - ((0.5 - a) * b) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(1.0 - log(t)) * z) tmp = 0.0 if (z <= -4.8e+156) tmp = t_1; elseif (z <= 1.25e+279) tmp = Float64(Float64(z + Float64(y + x)) - Float64(Float64(0.5 - a) * b)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (1.0 - log(t)) * z; tmp = 0.0; if (z <= -4.8e+156) tmp = t_1; elseif (z <= 1.25e+279) tmp = (z + (y + x)) - ((0.5 - a) * b); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -4.8e+156], t$95$1, If[LessEqual[z, 1.25e+279], N[(N[(z + N[(y + x), $MachinePrecision]), $MachinePrecision] - N[(N[(0.5 - a), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(1 - \log t\right) \cdot z\\
\mathbf{if}\;z \leq -4.8 \cdot 10^{+156}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{+279}:\\
\;\;\;\;\left(z + \left(y + x\right)\right) - \left(0.5 - a\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -4.8000000000000002e156 or 1.25e279 < z Initial program 99.7%
Taylor expanded in z around inf
*-commutativeN/A
sub-negN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
sub-negN/A
lower--.f64N/A
lower-log.f6477.9
Applied rewrites77.9%
if -4.8000000000000002e156 < z < 1.25e279Initial program 99.9%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lower--.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower--.f6499.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.9
Applied rewrites99.9%
Taylor expanded in z around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
distribute-lft-inN/A
metadata-evalN/A
+-commutativeN/A
neg-mul-1N/A
sub-negN/A
lower--.f6486.6
Applied rewrites86.6%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* b (- a 0.5)))) (if (<= t_1 -5e+152) t_1 (if (<= t_1 2e+220) (fma -0.5 b (+ y x)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = b * (a - 0.5);
double tmp;
if (t_1 <= -5e+152) {
tmp = t_1;
} else if (t_1 <= 2e+220) {
tmp = fma(-0.5, b, (y + x));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(b * Float64(a - 0.5)) tmp = 0.0 if (t_1 <= -5e+152) tmp = t_1; elseif (t_1 <= 2e+220) tmp = fma(-0.5, b, Float64(y + x)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(b * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+152], t$95$1, If[LessEqual[t$95$1, 2e+220], N[(-0.5 * b + N[(y + x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := b \cdot \left(a - 0.5\right)\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+152}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+220}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, b, y + x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < -5e152 or 2e220 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) Initial program 100.0%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6483.3
Applied rewrites83.3%
if -5e152 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < 2e220Initial program 99.8%
Taylor expanded in a around 0
*-commutativeN/A
cancel-sign-sub-invN/A
log-recN/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
associate-+r+N/A
associate-+l+N/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
log-recN/A
cancel-sign-sub-invN/A
*-commutativeN/A
lower-+.f64N/A
Applied rewrites92.9%
Taylor expanded in z around 0
Applied rewrites63.1%
Final simplification69.2%
(FPCore (x y z t a b) :precision binary64 (if (<= a -126000.0) (* b a) (if (<= a 2.85e-25) (* -0.5 b) (* b a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -126000.0) {
tmp = b * a;
} else if (a <= 2.85e-25) {
tmp = -0.5 * b;
} else {
tmp = b * a;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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) :: tmp
if (a <= (-126000.0d0)) then
tmp = b * a
else if (a <= 2.85d-25) then
tmp = (-0.5d0) * b
else
tmp = b * a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -126000.0) {
tmp = b * a;
} else if (a <= 2.85e-25) {
tmp = -0.5 * b;
} else {
tmp = b * a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= -126000.0: tmp = b * a elif a <= 2.85e-25: tmp = -0.5 * b else: tmp = b * a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -126000.0) tmp = Float64(b * a); elseif (a <= 2.85e-25) tmp = Float64(-0.5 * b); else tmp = Float64(b * a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (a <= -126000.0) tmp = b * a; elseif (a <= 2.85e-25) tmp = -0.5 * b; else tmp = b * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -126000.0], N[(b * a), $MachinePrecision], If[LessEqual[a, 2.85e-25], N[(-0.5 * b), $MachinePrecision], N[(b * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -126000:\\
\;\;\;\;b \cdot a\\
\mathbf{elif}\;a \leq 2.85 \cdot 10^{-25}:\\
\;\;\;\;-0.5 \cdot b\\
\mathbf{else}:\\
\;\;\;\;b \cdot a\\
\end{array}
\end{array}
if a < -126000 or 2.8500000000000002e-25 < a Initial program 99.9%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f6447.8
Applied rewrites47.8%
if -126000 < a < 2.8500000000000002e-25Initial program 99.8%
Taylor expanded in a around 0
*-commutativeN/A
cancel-sign-sub-invN/A
log-recN/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
associate-+r+N/A
associate-+l+N/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
log-recN/A
cancel-sign-sub-invN/A
*-commutativeN/A
lower-+.f64N/A
Applied rewrites99.2%
Taylor expanded in b around inf
Applied rewrites22.3%
(FPCore (x y z t a b) :precision binary64 (- (+ z (+ y x)) (* (- 0.5 a) b)))
double code(double x, double y, double z, double t, double a, double b) {
return (z + (y + x)) - ((0.5 - a) * b);
}
real(8) function code(x, y, z, t, a, b)
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
code = (z + (y + x)) - ((0.5d0 - a) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return (z + (y + x)) - ((0.5 - a) * b);
}
def code(x, y, z, t, a, b): return (z + (y + x)) - ((0.5 - a) * b)
function code(x, y, z, t, a, b) return Float64(Float64(z + Float64(y + x)) - Float64(Float64(0.5 - a) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = (z + (y + x)) - ((0.5 - a) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(z + N[(y + x), $MachinePrecision]), $MachinePrecision] - N[(N[(0.5 - a), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(z + \left(y + x\right)\right) - \left(0.5 - a\right) \cdot b
\end{array}
Initial program 99.9%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lower--.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower--.f6499.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.9
Applied rewrites99.9%
Taylor expanded in z around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
distribute-lft-inN/A
metadata-evalN/A
+-commutativeN/A
neg-mul-1N/A
sub-negN/A
lower--.f6477.3
Applied rewrites77.3%
(FPCore (x y z t a b) :precision binary64 (fma (- a 0.5) b (+ y x)))
double code(double x, double y, double z, double t, double a, double b) {
return fma((a - 0.5), b, (y + x));
}
function code(x, y, z, t, a, b) return fma(Float64(a - 0.5), b, Float64(y + x)) end
code[x_, y_, z_, t_, a_, b_] := N[(N[(a - 0.5), $MachinePrecision] * b + N[(y + x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(a - 0.5, b, y + x\right)
\end{array}
Initial program 99.9%
Taylor expanded in z around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f6476.2
Applied rewrites76.2%
(FPCore (x y z t a b) :precision binary64 (* b (- a 0.5)))
double code(double x, double y, double z, double t, double a, double b) {
return b * (a - 0.5);
}
real(8) function code(x, y, z, t, a, b)
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
code = b * (a - 0.5d0)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return b * (a - 0.5);
}
def code(x, y, z, t, a, b): return b * (a - 0.5)
function code(x, y, z, t, a, b) return Float64(b * Float64(a - 0.5)) end
function tmp = code(x, y, z, t, a, b) tmp = b * (a - 0.5); end
code[x_, y_, z_, t_, a_, b_] := N[(b * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
b \cdot \left(a - 0.5\right)
\end{array}
Initial program 99.9%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6435.7
Applied rewrites35.7%
Final simplification35.7%
(FPCore (x y z t a b) :precision binary64 (* -0.5 b))
double code(double x, double y, double z, double t, double a, double b) {
return -0.5 * b;
}
real(8) function code(x, y, z, t, a, b)
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
code = (-0.5d0) * b
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return -0.5 * b;
}
def code(x, y, z, t, a, b): return -0.5 * b
function code(x, y, z, t, a, b) return Float64(-0.5 * b) end
function tmp = code(x, y, z, t, a, b) tmp = -0.5 * b; end
code[x_, y_, z_, t_, a_, b_] := N[(-0.5 * b), $MachinePrecision]
\begin{array}{l}
\\
-0.5 \cdot b
\end{array}
Initial program 99.9%
Taylor expanded in a around 0
*-commutativeN/A
cancel-sign-sub-invN/A
log-recN/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
associate-+r+N/A
associate-+l+N/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
log-recN/A
cancel-sign-sub-invN/A
*-commutativeN/A
lower-+.f64N/A
Applied rewrites75.9%
Taylor expanded in b around inf
Applied rewrites12.1%
(FPCore (x y z t a b) :precision binary64 (+ (+ (+ x y) (/ (* (- 1.0 (pow (log t) 2.0)) z) (+ 1.0 (log t)))) (* (- a 0.5) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x + y) + (((1.0 - pow(log(t), 2.0)) * z) / (1.0 + log(t)))) + ((a - 0.5) * b);
}
real(8) function code(x, y, z, t, a, b)
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
code = ((x + y) + (((1.0d0 - (log(t) ** 2.0d0)) * z) / (1.0d0 + log(t)))) + ((a - 0.5d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x + y) + (((1.0 - Math.pow(Math.log(t), 2.0)) * z) / (1.0 + Math.log(t)))) + ((a - 0.5) * b);
}
def code(x, y, z, t, a, b): return ((x + y) + (((1.0 - math.pow(math.log(t), 2.0)) * z) / (1.0 + math.log(t)))) + ((a - 0.5) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x + y) + Float64(Float64(Float64(1.0 - (log(t) ^ 2.0)) * z) / Float64(1.0 + log(t)))) + Float64(Float64(a - 0.5) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x + y) + (((1.0 - (log(t) ^ 2.0)) * z) / (1.0 + log(t)))) + ((a - 0.5) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x + y), $MachinePrecision] + N[(N[(N[(1.0 - N[Power[N[Log[t], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision] / N[(1.0 + N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + y\right) + \frac{\left(1 - {\log t}^{2}\right) \cdot z}{1 + \log t}\right) + \left(a - 0.5\right) \cdot b
\end{array}
herbie shell --seed 2024332
(FPCore (x y z t a b)
:name "Numeric.SpecFunctions:logBeta from math-functions-0.1.5.2, A"
:precision binary64
:alt
(! :herbie-platform default (+ (+ (+ x y) (/ (* (- 1 (pow (log t) 2)) z) (+ 1 (log t)))) (* (- a 1/2) b)))
(+ (- (+ (+ x y) z) (* z (log t))) (* (- a 0.5) b)))