
(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 15 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 (+ (- (+ z (+ x y)) (* z (log t))) (fma b a (* b -0.5))))
double code(double x, double y, double z, double t, double a, double b) {
return ((z + (x + y)) - (z * log(t))) + fma(b, a, (b * -0.5));
}
function code(x, y, z, t, a, b) return Float64(Float64(Float64(z + Float64(x + y)) - Float64(z * log(t))) + fma(b, a, Float64(b * -0.5))) end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(z + N[(x + y), $MachinePrecision]), $MachinePrecision] - N[(z * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(b * a + N[(b * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(z + \left(x + y\right)\right) - z \cdot \log t\right) + \mathsf{fma}\left(b, a, b \cdot -0.5\right)
\end{array}
Initial program 99.8%
lift--.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
lower-fma.f64N/A
lower-*.f64N/A
metadata-eval99.9
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (- 1.0 (log t)))
(t_2 (* b (- a 0.5)))
(t_3 (fma z t_1 (fma b (+ a -0.5) y))))
(if (<= t_2 -2e+157)
t_3
(if (<= t_2 1e+85) (+ (fma z t_1 y) (fma b -0.5 x)) t_3))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = 1.0 - log(t);
double t_2 = b * (a - 0.5);
double t_3 = fma(z, t_1, fma(b, (a + -0.5), y));
double tmp;
if (t_2 <= -2e+157) {
tmp = t_3;
} else if (t_2 <= 1e+85) {
tmp = fma(z, t_1, y) + fma(b, -0.5, x);
} else {
tmp = t_3;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(1.0 - log(t)) t_2 = Float64(b * Float64(a - 0.5)) t_3 = fma(z, t_1, fma(b, Float64(a + -0.5), y)) tmp = 0.0 if (t_2 <= -2e+157) tmp = t_3; elseif (t_2 <= 1e+85) tmp = Float64(fma(z, t_1, y) + fma(b, -0.5, x)); else tmp = t_3; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(b * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(z * t$95$1 + N[(b * N[(a + -0.5), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+157], t$95$3, If[LessEqual[t$95$2, 1e+85], N[(N[(z * t$95$1 + y), $MachinePrecision] + N[(b * -0.5 + x), $MachinePrecision]), $MachinePrecision], t$95$3]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 1 - \log t\\
t_2 := b \cdot \left(a - 0.5\right)\\
t_3 := \mathsf{fma}\left(z, t\_1, \mathsf{fma}\left(b, a + -0.5, y\right)\right)\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+157}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 10^{+85}:\\
\;\;\;\;\mathsf{fma}\left(z, t\_1, y\right) + \mathsf{fma}\left(b, -0.5, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < -1.99999999999999997e157 or 1e85 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) Initial program 99.9%
Taylor expanded in x around 0
*-commutativeN/A
cancel-sign-sub-invN/A
log-recN/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
associate-+r+N/A
*-rgt-identityN/A
distribute-lft-inN/A
+-commutativeN/A
log-recN/A
sub-negN/A
Simplified89.6%
if -1.99999999999999997e157 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < 1e85Initial 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
Simplified96.9%
Final simplification93.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* b (- a 0.5))) (t_2 (+ (fma b a (* b -0.5)) (+ x y))))
(if (<= t_1 -5e+120)
t_2
(if (<= t_1 5e+123) (+ (fma z (- 1.0 (log t)) y) (fma b -0.5 x)) t_2))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = b * (a - 0.5);
double t_2 = fma(b, a, (b * -0.5)) + (x + y);
double tmp;
if (t_1 <= -5e+120) {
tmp = t_2;
} else if (t_1 <= 5e+123) {
tmp = fma(z, (1.0 - log(t)), y) + fma(b, -0.5, x);
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(b * Float64(a - 0.5)) t_2 = Float64(fma(b, a, Float64(b * -0.5)) + Float64(x + y)) tmp = 0.0 if (t_1 <= -5e+120) tmp = t_2; elseif (t_1 <= 5e+123) tmp = Float64(fma(z, Float64(1.0 - log(t)), y) + fma(b, -0.5, x)); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(b * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(b * a + N[(b * -0.5), $MachinePrecision]), $MachinePrecision] + N[(x + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+120], t$95$2, If[LessEqual[t$95$1, 5e+123], N[(N[(z * N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision] + N[(b * -0.5 + x), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := b \cdot \left(a - 0.5\right)\\
t_2 := \mathsf{fma}\left(b, a, b \cdot -0.5\right) + \left(x + y\right)\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+120}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+123}:\\
\;\;\;\;\mathsf{fma}\left(z, 1 - \log t, y\right) + \mathsf{fma}\left(b, -0.5, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < -5.00000000000000019e120 or 4.99999999999999974e123 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) Initial program 99.9%
lift--.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
lower-fma.f64N/A
lower-*.f64N/A
metadata-eval99.9
Applied egg-rr99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f6492.4
Simplified92.4%
if -5.00000000000000019e120 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < 4.99999999999999974e123Initial 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
Simplified96.9%
Final simplification94.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* b (- a 0.5))) (t_2 (+ (fma b a (* b -0.5)) (+ x y))))
(if (<= t_1 -1e+84)
t_2
(if (<= t_1 5e+123) (fma z (- 1.0 (log t)) (+ x y)) t_2))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = b * (a - 0.5);
double t_2 = fma(b, a, (b * -0.5)) + (x + y);
double tmp;
if (t_1 <= -1e+84) {
tmp = t_2;
} else if (t_1 <= 5e+123) {
tmp = fma(z, (1.0 - log(t)), (x + y));
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(b * Float64(a - 0.5)) t_2 = Float64(fma(b, a, Float64(b * -0.5)) + Float64(x + y)) tmp = 0.0 if (t_1 <= -1e+84) tmp = t_2; elseif (t_1 <= 5e+123) tmp = fma(z, Float64(1.0 - log(t)), Float64(x + y)); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(b * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(b * a + N[(b * -0.5), $MachinePrecision]), $MachinePrecision] + N[(x + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+84], t$95$2, If[LessEqual[t$95$1, 5e+123], N[(z * N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision] + N[(x + y), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := b \cdot \left(a - 0.5\right)\\
t_2 := \mathsf{fma}\left(b, a, b \cdot -0.5\right) + \left(x + y\right)\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+84}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+123}:\\
\;\;\;\;\mathsf{fma}\left(z, 1 - \log t, x + y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < -1.00000000000000006e84 or 4.99999999999999974e123 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) Initial program 99.9%
lift--.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
lower-fma.f64N/A
lower-*.f64N/A
metadata-eval99.9
Applied egg-rr99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f6491.9
Simplified91.9%
if -1.00000000000000006e84 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < 4.99999999999999974e123Initial program 99.8%
Taylor expanded in b around 0
cancel-sign-sub-invN/A
associate-+r+N/A
associate-+l+N/A
cancel-sign-sub-invN/A
*-rgt-identityN/A
distribute-lft-out--N/A
+-commutativeN/A
*-commutativeN/A
sub-negN/A
mul-1-negN/A
*-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
sub-negN/A
lower--.f64N/A
lower-log.f64N/A
+-commutativeN/A
lower-+.f6492.8
Simplified92.8%
Final simplification92.4%
(FPCore (x y z t a b) :precision binary64 (+ (- (+ z (+ x y)) (* z (log t))) (* b (- a 0.5))))
double code(double x, double y, double z, double t, double a, double b) {
return ((z + (x + y)) - (z * log(t))) + (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 = ((z + (x + y)) - (z * log(t))) + (b * (a - 0.5d0))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((z + (x + y)) - (z * Math.log(t))) + (b * (a - 0.5));
}
def code(x, y, z, t, a, b): return ((z + (x + y)) - (z * math.log(t))) + (b * (a - 0.5))
function code(x, y, z, t, a, b) return Float64(Float64(Float64(z + Float64(x + y)) - Float64(z * log(t))) + Float64(b * Float64(a - 0.5))) end
function tmp = code(x, y, z, t, a, b) tmp = ((z + (x + y)) - (z * log(t))) + (b * (a - 0.5)); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(z + N[(x + y), $MachinePrecision]), $MachinePrecision] - N[(z * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(b * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(z + \left(x + y\right)\right) - z \cdot \log t\right) + b \cdot \left(a - 0.5\right)
\end{array}
Initial program 99.8%
Final simplification99.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma z (- 1.0 (log t)) y)))
(if (<= z -1.3e+121)
t_1
(if (<= z 1.85e+194) (+ (fma b a (* b -0.5)) (+ x y)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(z, (1.0 - log(t)), y);
double tmp;
if (z <= -1.3e+121) {
tmp = t_1;
} else if (z <= 1.85e+194) {
tmp = fma(b, a, (b * -0.5)) + (x + y);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(z, Float64(1.0 - log(t)), y) tmp = 0.0 if (z <= -1.3e+121) tmp = t_1; elseif (z <= 1.85e+194) tmp = Float64(fma(b, a, Float64(b * -0.5)) + Float64(x + y)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(z * N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision]}, If[LessEqual[z, -1.3e+121], t$95$1, If[LessEqual[z, 1.85e+194], N[(N[(b * a + N[(b * -0.5), $MachinePrecision]), $MachinePrecision] + N[(x + y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(z, 1 - \log t, y\right)\\
\mathbf{if}\;z \leq -1.3 \cdot 10^{+121}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.85 \cdot 10^{+194}:\\
\;\;\;\;\mathsf{fma}\left(b, a, b \cdot -0.5\right) + \left(x + y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.2999999999999999e121 or 1.8500000000000001e194 < z Initial program 99.6%
Taylor expanded in x around 0
*-commutativeN/A
cancel-sign-sub-invN/A
log-recN/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
associate-+r+N/A
*-rgt-identityN/A
distribute-lft-inN/A
+-commutativeN/A
log-recN/A
sub-negN/A
Simplified96.6%
Taylor expanded in b around 0
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-log.f6476.8
Simplified76.8%
if -1.2999999999999999e121 < z < 1.8500000000000001e194Initial program 99.9%
lift--.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
lower-fma.f64N/A
lower-*.f64N/A
metadata-eval99.9
Applied egg-rr99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f6487.3
Simplified87.3%
Final simplification84.9%
(FPCore (x y z t a b)
:precision binary64
(if (<= z -3e+192)
(- z (* z (log t)))
(if (<= z 1.12e+207)
(+ (fma b a (* b -0.5)) (+ x y))
(fma (log t) (- z) z))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -3e+192) {
tmp = z - (z * log(t));
} else if (z <= 1.12e+207) {
tmp = fma(b, a, (b * -0.5)) + (x + y);
} else {
tmp = fma(log(t), -z, z);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -3e+192) tmp = Float64(z - Float64(z * log(t))); elseif (z <= 1.12e+207) tmp = Float64(fma(b, a, Float64(b * -0.5)) + Float64(x + y)); else tmp = fma(log(t), Float64(-z), z); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -3e+192], N[(z - N[(z * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.12e+207], N[(N[(b * a + N[(b * -0.5), $MachinePrecision]), $MachinePrecision] + N[(x + y), $MachinePrecision]), $MachinePrecision], N[(N[Log[t], $MachinePrecision] * (-z) + z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3 \cdot 10^{+192}:\\
\;\;\;\;z - z \cdot \log t\\
\mathbf{elif}\;z \leq 1.12 \cdot 10^{+207}:\\
\;\;\;\;\mathsf{fma}\left(b, a, b \cdot -0.5\right) + \left(x + y\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log t, -z, z\right)\\
\end{array}
\end{array}
if z < -3e192Initial program 99.6%
Taylor expanded in z around inf
*-commutativeN/A
sub-negN/A
log-recN/A
+-commutativeN/A
distribute-lft1-inN/A
log-recN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-inN/A
neg-mul-1N/A
lower-fma.f64N/A
lower-log.f64N/A
neg-mul-1N/A
lower-neg.f6479.9
Simplified79.9%
lift-log.f64N/A
lift-neg.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-neg.f64N/A
cancel-sign-sub-invN/A
lift-*.f64N/A
lower--.f6479.9
Applied egg-rr79.9%
if -3e192 < z < 1.1199999999999999e207Initial program 99.9%
lift--.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
lower-fma.f64N/A
lower-*.f64N/A
metadata-eval99.9
Applied egg-rr99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f6483.8
Simplified83.8%
if 1.1199999999999999e207 < z Initial program 99.5%
Taylor expanded in z around inf
*-commutativeN/A
sub-negN/A
log-recN/A
+-commutativeN/A
distribute-lft1-inN/A
log-recN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-inN/A
neg-mul-1N/A
lower-fma.f64N/A
lower-log.f64N/A
neg-mul-1N/A
lower-neg.f6475.7
Simplified75.7%
Final simplification83.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (- z (* z (log t)))))
(if (<= z -3e+192)
t_1
(if (<= z 1.12e+207) (+ (fma b a (* b -0.5)) (+ x y)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = z - (z * log(t));
double tmp;
if (z <= -3e+192) {
tmp = t_1;
} else if (z <= 1.12e+207) {
tmp = fma(b, a, (b * -0.5)) + (x + y);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(z - Float64(z * log(t))) tmp = 0.0 if (z <= -3e+192) tmp = t_1; elseif (z <= 1.12e+207) tmp = Float64(fma(b, a, Float64(b * -0.5)) + Float64(x + y)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(z - N[(z * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3e+192], t$95$1, If[LessEqual[z, 1.12e+207], N[(N[(b * a + N[(b * -0.5), $MachinePrecision]), $MachinePrecision] + N[(x + y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z - z \cdot \log t\\
\mathbf{if}\;z \leq -3 \cdot 10^{+192}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.12 \cdot 10^{+207}:\\
\;\;\;\;\mathsf{fma}\left(b, a, b \cdot -0.5\right) + \left(x + y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3e192 or 1.1199999999999999e207 < z Initial program 99.6%
Taylor expanded in z around inf
*-commutativeN/A
sub-negN/A
log-recN/A
+-commutativeN/A
distribute-lft1-inN/A
log-recN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-inN/A
neg-mul-1N/A
lower-fma.f64N/A
lower-log.f64N/A
neg-mul-1N/A
lower-neg.f6478.0
Simplified78.0%
lift-log.f64N/A
lift-neg.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-neg.f64N/A
cancel-sign-sub-invN/A
lift-*.f64N/A
lower--.f6478.0
Applied egg-rr78.0%
if -3e192 < z < 1.1199999999999999e207Initial program 99.9%
lift--.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
lower-fma.f64N/A
lower-*.f64N/A
metadata-eval99.9
Applied egg-rr99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f6483.8
Simplified83.8%
Final simplification83.0%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* b (- a 0.5))) (t_2 (fma b (+ a -0.5) y))) (if (<= t_1 -4e+152) t_2 (if (<= t_1 1e+94) (+ y (fma -0.5 b x)) t_2))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = b * (a - 0.5);
double t_2 = fma(b, (a + -0.5), y);
double tmp;
if (t_1 <= -4e+152) {
tmp = t_2;
} else if (t_1 <= 1e+94) {
tmp = y + fma(-0.5, b, x);
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(b * Float64(a - 0.5)) t_2 = fma(b, Float64(a + -0.5), y) tmp = 0.0 if (t_1 <= -4e+152) tmp = t_2; elseif (t_1 <= 1e+94) tmp = Float64(y + fma(-0.5, b, x)); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(b * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(b * N[(a + -0.5), $MachinePrecision] + y), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+152], t$95$2, If[LessEqual[t$95$1, 1e+94], N[(y + N[(-0.5 * b + x), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := b \cdot \left(a - 0.5\right)\\
t_2 := \mathsf{fma}\left(b, a + -0.5, y\right)\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+152}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 10^{+94}:\\
\;\;\;\;y + \mathsf{fma}\left(-0.5, b, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < -4.0000000000000002e152 or 1e94 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) Initial program 99.9%
Taylor expanded in x around 0
*-commutativeN/A
cancel-sign-sub-invN/A
log-recN/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
associate-+r+N/A
*-rgt-identityN/A
distribute-lft-inN/A
+-commutativeN/A
log-recN/A
sub-negN/A
Simplified91.2%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-+.f6479.3
Simplified79.3%
if -4.0000000000000002e152 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < 1e94Initial 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
Simplified96.2%
Taylor expanded in z around 0
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
lower-+.f64N/A
+-commutativeN/A
lower-fma.f6461.2
Simplified61.2%
Final simplification69.2%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* b (- a 0.5))) (t_2 (* b (+ a -0.5)))) (if (<= t_1 -2e+193) t_2 (if (<= t_1 1e+186) (+ y (fma -0.5 b x)) t_2))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = b * (a - 0.5);
double t_2 = b * (a + -0.5);
double tmp;
if (t_1 <= -2e+193) {
tmp = t_2;
} else if (t_1 <= 1e+186) {
tmp = y + fma(-0.5, b, x);
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(b * Float64(a - 0.5)) t_2 = Float64(b * Float64(a + -0.5)) tmp = 0.0 if (t_1 <= -2e+193) tmp = t_2; elseif (t_1 <= 1e+186) tmp = Float64(y + fma(-0.5, b, x)); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(b * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(b * N[(a + -0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+193], t$95$2, If[LessEqual[t$95$1, 1e+186], N[(y + N[(-0.5 * b + x), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := b \cdot \left(a - 0.5\right)\\
t_2 := b \cdot \left(a + -0.5\right)\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+193}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 10^{+186}:\\
\;\;\;\;y + \mathsf{fma}\left(-0.5, b, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < -2.00000000000000013e193 or 9.9999999999999998e185 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) Initial program 99.9%
Taylor expanded in b around inf
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-+.f6487.8
Simplified87.8%
if -2.00000000000000013e193 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < 9.9999999999999998e185Initial 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
Simplified93.9%
Taylor expanded in z around 0
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
lower-+.f64N/A
+-commutativeN/A
lower-fma.f6458.7
Simplified58.7%
Final simplification68.3%
(FPCore (x y z t a b) :precision binary64 (if (<= a -0.004) (* b a) (if (<= a 0.00064) (* b -0.5) (* b a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -0.004) {
tmp = b * a;
} else if (a <= 0.00064) {
tmp = b * -0.5;
} 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 <= (-0.004d0)) then
tmp = b * a
else if (a <= 0.00064d0) then
tmp = b * (-0.5d0)
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 <= -0.004) {
tmp = b * a;
} else if (a <= 0.00064) {
tmp = b * -0.5;
} else {
tmp = b * a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= -0.004: tmp = b * a elif a <= 0.00064: tmp = b * -0.5 else: tmp = b * a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -0.004) tmp = Float64(b * a); elseif (a <= 0.00064) tmp = Float64(b * -0.5); else tmp = Float64(b * a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (a <= -0.004) tmp = b * a; elseif (a <= 0.00064) tmp = b * -0.5; else tmp = b * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -0.004], N[(b * a), $MachinePrecision], If[LessEqual[a, 0.00064], N[(b * -0.5), $MachinePrecision], N[(b * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.004:\\
\;\;\;\;b \cdot a\\
\mathbf{elif}\;a \leq 0.00064:\\
\;\;\;\;b \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;b \cdot a\\
\end{array}
\end{array}
if a < -0.0040000000000000001 or 6.40000000000000052e-4 < a Initial program 99.9%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f6452.1
Simplified52.1%
if -0.0040000000000000001 < a < 6.40000000000000052e-4Initial program 99.8%
Taylor expanded in b around inf
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-+.f6427.2
Simplified27.2%
Taylor expanded in a around 0
Simplified27.0%
(FPCore (x y z t a b) :precision binary64 (+ (fma b a (* b -0.5)) (+ x y)))
double code(double x, double y, double z, double t, double a, double b) {
return fma(b, a, (b * -0.5)) + (x + y);
}
function code(x, y, z, t, a, b) return Float64(fma(b, a, Float64(b * -0.5)) + Float64(x + y)) end
code[x_, y_, z_, t_, a_, b_] := N[(N[(b * a + N[(b * -0.5), $MachinePrecision]), $MachinePrecision] + N[(x + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(b, a, b \cdot -0.5\right) + \left(x + y\right)
\end{array}
Initial program 99.8%
lift--.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
lower-fma.f64N/A
lower-*.f64N/A
metadata-eval99.9
Applied egg-rr99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f6475.1
Simplified75.1%
Final simplification75.1%
(FPCore (x y z t a b) :precision binary64 (+ y (fma b (+ a -0.5) x)))
double code(double x, double y, double z, double t, double a, double b) {
return y + fma(b, (a + -0.5), x);
}
function code(x, y, z, t, a, b) return Float64(y + fma(b, Float64(a + -0.5), x)) end
code[x_, y_, z_, t_, a_, b_] := N[(y + N[(b * N[(a + -0.5), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y + \mathsf{fma}\left(b, a + -0.5, x\right)
\end{array}
Initial program 99.8%
Taylor expanded in z around 0
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
lower-+.f64N/A
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-+.f6475.1
Simplified75.1%
(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.8%
Taylor expanded in b around inf
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-+.f6440.0
Simplified40.0%
(FPCore (x y z t a b) :precision binary64 (* b -0.5))
double code(double x, double y, double z, double t, double a, double b) {
return b * -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 * (-0.5d0)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return b * -0.5;
}
def code(x, y, z, t, a, b): return b * -0.5
function code(x, y, z, t, a, b) return Float64(b * -0.5) end
function tmp = code(x, y, z, t, a, b) tmp = b * -0.5; end
code[x_, y_, z_, t_, a_, b_] := N[(b * -0.5), $MachinePrecision]
\begin{array}{l}
\\
b \cdot -0.5
\end{array}
Initial program 99.8%
Taylor expanded in b around inf
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-+.f6440.0
Simplified40.0%
Taylor expanded in a around 0
Simplified14.8%
(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 2024207
(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)))