
(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 20 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 (fma (- a 0.5) b (fma (- z) (log t) (+ (+ x y) z))))
double code(double x, double y, double z, double t, double a, double b) {
return fma((a - 0.5), b, fma(-z, log(t), ((x + y) + z)));
}
function code(x, y, z, t, a, b) return fma(Float64(a - 0.5), b, fma(Float64(-z), log(t), Float64(Float64(x + y) + z))) end
code[x_, y_, z_, t_, a_, b_] := N[(N[(a - 0.5), $MachinePrecision] * b + N[((-z) * N[Log[t], $MachinePrecision] + N[(N[(x + y), $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(a - 0.5, b, \mathsf{fma}\left(-z, \log t, \left(x + y\right) + z\right)\right)
\end{array}
Initial program 99.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6499.9
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
Final simplification99.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* b (- a 0.5))) (t_2 (+ (- (+ (+ x y) z) (* (log t) z)) t_1)))
(if (<= t_2 -2e-147)
(fma (- a 0.5) b x)
(if (<= t_2 5e+297) (+ (* -0.5 b) y) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = b * (a - 0.5);
double t_2 = (((x + y) + z) - (log(t) * z)) + t_1;
double tmp;
if (t_2 <= -2e-147) {
tmp = fma((a - 0.5), b, x);
} else if (t_2 <= 5e+297) {
tmp = (-0.5 * b) + y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(b * Float64(a - 0.5)) t_2 = Float64(Float64(Float64(Float64(x + y) + z) - Float64(log(t) * z)) + t_1) tmp = 0.0 if (t_2 <= -2e-147) tmp = fma(Float64(a - 0.5), b, x); elseif (t_2 <= 5e+297) tmp = Float64(Float64(-0.5 * b) + y); 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]}, Block[{t$95$2 = N[(N[(N[(N[(x + y), $MachinePrecision] + z), $MachinePrecision] - N[(N[Log[t], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, -2e-147], N[(N[(a - 0.5), $MachinePrecision] * b + x), $MachinePrecision], If[LessEqual[t$95$2, 5e+297], N[(N[(-0.5 * b), $MachinePrecision] + y), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := b \cdot \left(a - 0.5\right)\\
t_2 := \left(\left(\left(x + y\right) + z\right) - \log t \cdot z\right) + t\_1\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{-147}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, x\right)\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+297}:\\
\;\;\;\;-0.5 \cdot b + y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t))) (*.f64 (-.f64 a #s(literal 1/2 binary64)) b)) < -1.9999999999999999e-147Initial 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
*-rgt-identityN/A
distribute-lft-inN/A
+-commutativeN/A
log-recN/A
sub-negN/A
*-commutativeN/A
sub-negN/A
mul-1-negN/A
lower-fma.f64N/A
Applied rewrites78.2%
Taylor expanded in z around 0
Applied rewrites57.8%
if -1.9999999999999999e-147 < (+.f64 (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t))) (*.f64 (-.f64 a #s(literal 1/2 binary64)) b)) < 4.9999999999999998e297Initial 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 rewrites99.9%
Taylor expanded in a around 0
sub-negN/A
associate-+l+N/A
associate-+r+N/A
associate-+r+N/A
+-commutativeN/A
mul-1-negN/A
associate-+r+N/A
+-commutativeN/A
associate-+r+N/A
Applied rewrites87.6%
Taylor expanded in b around inf
Applied rewrites39.9%
if 4.9999999999999998e297 < (+.f64 (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t))) (*.f64 (-.f64 a #s(literal 1/2 binary64)) b)) Initial program 99.8%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6475.5
Applied rewrites75.5%
Final simplification50.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* b (- a 0.5))))
(if (<= t_1 -5e-29)
(+ (fma b a (* -0.5 b)) (+ x y))
(if (<= t_1 1e+106)
(+ (fma -0.5 b (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-29) {
tmp = fma(b, a, (-0.5 * b)) + (x + y);
} else if (t_1 <= 1e+106) {
tmp = fma(-0.5, b, 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-29) tmp = Float64(fma(b, a, Float64(-0.5 * b)) + Float64(x + y)); elseif (t_1 <= 1e+106) tmp = Float64(fma(-0.5, b, fma(Float64(1.0 - log(t)), z, y)) + x); else tmp = Float64(fma(Float64(a - 0.5), b, 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-29], N[(N[(b * a + N[(-0.5 * b), $MachinePrecision]), $MachinePrecision] + N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+106], N[(N[(-0.5 * b + N[(N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision] * z + y), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(a - 0.5), $MachinePrecision] * b + y), $MachinePrecision] + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := b \cdot \left(a - 0.5\right)\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{-29}:\\
\;\;\;\;\mathsf{fma}\left(b, a, -0.5 \cdot b\right) + \left(x + y\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+106}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, b, \mathsf{fma}\left(1 - \log t, z, y\right)\right) + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, y\right) + x\\
\end{array}
\end{array}
if (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < -4.99999999999999986e-29Initial 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 rewrites99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f6488.9
Applied rewrites88.9%
if -4.99999999999999986e-29 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < 1.00000000000000009e106Initial program 99.8%
Taylor expanded in a around 0
associate--l+N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites97.5%
if 1.00000000000000009e106 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6491.6
Applied rewrites91.6%
Final simplification93.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* b (- a 0.5))))
(if (<= t_1 -5e-29)
(+ (fma b a (* -0.5 b)) (+ x y))
(if (<= t_1 1e+106)
(fma (- 1.0 (log t)) z (+ 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 <= -5e-29) {
tmp = fma(b, a, (-0.5 * b)) + (x + y);
} else if (t_1 <= 1e+106) {
tmp = fma((1.0 - log(t)), z, (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 <= -5e-29) tmp = Float64(fma(b, a, Float64(-0.5 * b)) + Float64(x + y)); elseif (t_1 <= 1e+106) tmp = fma(Float64(1.0 - log(t)), z, Float64(x + y)); else tmp = Float64(fma(Float64(a - 0.5), b, 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-29], N[(N[(b * a + N[(-0.5 * b), $MachinePrecision]), $MachinePrecision] + N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+106], N[(N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision] * z + N[(x + y), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a - 0.5), $MachinePrecision] * b + y), $MachinePrecision] + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := b \cdot \left(a - 0.5\right)\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{-29}:\\
\;\;\;\;\mathsf{fma}\left(b, a, -0.5 \cdot b\right) + \left(x + y\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+106}:\\
\;\;\;\;\mathsf{fma}\left(1 - \log t, z, x + y\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, y\right) + x\\
\end{array}
\end{array}
if (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < -4.99999999999999986e-29Initial 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 rewrites99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f6488.9
Applied rewrites88.9%
if -4.99999999999999986e-29 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < 1.00000000000000009e106Initial 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
lower-fma.f64N/A
mul-1-negN/A
sub-negN/A
lower--.f64N/A
lower-log.f64N/A
+-commutativeN/A
lower-+.f6496.9
Applied rewrites96.9%
if 1.00000000000000009e106 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6491.6
Applied rewrites91.6%
Final simplification93.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (- 1.0 (log t))))
(if (<= (+ x y) -1e-123)
(fma t_1 z (fma (- a 0.5) b x))
(fma (- a 0.5) b (fma t_1 z y)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = 1.0 - log(t);
double tmp;
if ((x + y) <= -1e-123) {
tmp = fma(t_1, z, fma((a - 0.5), b, x));
} else {
tmp = fma((a - 0.5), b, fma(t_1, z, y));
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(1.0 - log(t)) tmp = 0.0 if (Float64(x + y) <= -1e-123) tmp = fma(t_1, z, fma(Float64(a - 0.5), b, x)); else tmp = fma(Float64(a - 0.5), b, fma(t_1, z, y)); 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[N[(x + y), $MachinePrecision], -1e-123], N[(t$95$1 * z + N[(N[(a - 0.5), $MachinePrecision] * b + x), $MachinePrecision]), $MachinePrecision], N[(N[(a - 0.5), $MachinePrecision] * b + N[(t$95$1 * z + y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 1 - \log t\\
\mathbf{if}\;x + y \leq -1 \cdot 10^{-123}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, z, \mathsf{fma}\left(a - 0.5, b, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, \mathsf{fma}\left(t\_1, z, y\right)\right)\\
\end{array}
\end{array}
if (+.f64 x y) < -1.0000000000000001e-123Initial 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
*-rgt-identityN/A
distribute-lft-inN/A
+-commutativeN/A
log-recN/A
sub-negN/A
*-commutativeN/A
sub-negN/A
mul-1-negN/A
lower-fma.f64N/A
Applied rewrites74.8%
if -1.0000000000000001e-123 < (+.f64 x y) Initial program 99.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6499.9
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in x around 0
mul-1-negN/A
sub-negN/A
*-rgt-identityN/A
distribute-lft-out--N/A
sub-negN/A
mul-1-negN/A
+-commutativeN/A
*-commutativeN/A
mul-1-negN/A
sub-negN/A
lower-fma.f64N/A
lower--.f64N/A
lower-log.f6478.0
Applied rewrites78.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (- 1.0 (log t))))
(if (<= (+ x y) -1e-123)
(fma t_1 z (fma (- a 0.5) b x))
(fma t_1 z (fma (- a 0.5) b y)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = 1.0 - log(t);
double tmp;
if ((x + y) <= -1e-123) {
tmp = fma(t_1, z, fma((a - 0.5), b, x));
} else {
tmp = fma(t_1, z, fma((a - 0.5), b, y));
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(1.0 - log(t)) tmp = 0.0 if (Float64(x + y) <= -1e-123) tmp = fma(t_1, z, fma(Float64(a - 0.5), b, x)); else tmp = fma(t_1, z, fma(Float64(a - 0.5), b, y)); 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[N[(x + y), $MachinePrecision], -1e-123], N[(t$95$1 * z + N[(N[(a - 0.5), $MachinePrecision] * b + x), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * z + N[(N[(a - 0.5), $MachinePrecision] * b + y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 1 - \log t\\
\mathbf{if}\;x + y \leq -1 \cdot 10^{-123}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, z, \mathsf{fma}\left(a - 0.5, b, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, z, \mathsf{fma}\left(a - 0.5, b, y\right)\right)\\
\end{array}
\end{array}
if (+.f64 x y) < -1.0000000000000001e-123Initial 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
*-rgt-identityN/A
distribute-lft-inN/A
+-commutativeN/A
log-recN/A
sub-negN/A
*-commutativeN/A
sub-negN/A
mul-1-negN/A
lower-fma.f64N/A
Applied rewrites74.8%
if -1.0000000000000001e-123 < (+.f64 x y) Initial program 99.9%
Taylor expanded in x around 0
*-commutativeN/A
cancel-sign-sub-invN/A
log-recN/A
*-commutativeN/A
+-commutativeN/A
associate-+r+N/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 rewrites78.0%
(FPCore (x y z t a b) :precision binary64 (if (<= (+ x y) 8e+43) (fma (- 1.0 (log t)) z (fma (- a 0.5) b x)) (+ (* b (- a 0.5)) (* (- (+ (/ x y) (/ z y)) -1.0) y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x + y) <= 8e+43) {
tmp = fma((1.0 - log(t)), z, fma((a - 0.5), b, x));
} else {
tmp = (b * (a - 0.5)) + ((((x / y) + (z / y)) - -1.0) * y);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(x + y) <= 8e+43) tmp = fma(Float64(1.0 - log(t)), z, fma(Float64(a - 0.5), b, x)); else tmp = Float64(Float64(b * Float64(a - 0.5)) + Float64(Float64(Float64(Float64(x / y) + Float64(z / y)) - -1.0) * y)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(x + y), $MachinePrecision], 8e+43], N[(N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision] * z + N[(N[(a - 0.5), $MachinePrecision] * b + x), $MachinePrecision]), $MachinePrecision], N[(N[(b * N[(a - 0.5), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(x / y), $MachinePrecision] + N[(z / y), $MachinePrecision]), $MachinePrecision] - -1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq 8 \cdot 10^{+43}:\\
\;\;\;\;\mathsf{fma}\left(1 - \log t, z, \mathsf{fma}\left(a - 0.5, b, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(a - 0.5\right) + \left(\left(\frac{x}{y} + \frac{z}{y}\right) - -1\right) \cdot y\\
\end{array}
\end{array}
if (+.f64 x y) < 8.00000000000000011e43Initial 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
*-rgt-identityN/A
distribute-lft-inN/A
+-commutativeN/A
log-recN/A
sub-negN/A
*-commutativeN/A
sub-negN/A
mul-1-negN/A
lower-fma.f64N/A
Applied rewrites83.2%
if 8.00000000000000011e43 < (+.f64 x y) Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
associate--l+N/A
+-commutativeN/A
associate-+l-N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f64N/A
sub-negN/A
associate-/l*N/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-log.f6486.4
Applied rewrites86.4%
Taylor expanded in z around 0
Applied rewrites80.7%
Final simplification82.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (* (- 1.0 (log t)) z) y)))
(if (<= z -5.8e+165)
t_1
(if (<= z 1e+215) (+ (fma b a (* -0.5 b)) (+ x y)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((1.0 - log(t)) * z) + y;
double tmp;
if (z <= -5.8e+165) {
tmp = t_1;
} else if (z <= 1e+215) {
tmp = fma(b, a, (-0.5 * b)) + (x + y);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(1.0 - log(t)) * z) + y) tmp = 0.0 if (z <= -5.8e+165) tmp = t_1; elseif (z <= 1e+215) tmp = Float64(fma(b, a, Float64(-0.5 * b)) + Float64(x + y)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision] + y), $MachinePrecision]}, If[LessEqual[z, -5.8e+165], t$95$1, If[LessEqual[z, 1e+215], N[(N[(b * a + N[(-0.5 * b), $MachinePrecision]), $MachinePrecision] + N[(x + y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(1 - \log t\right) \cdot z + y\\
\mathbf{if}\;z \leq -5.8 \cdot 10^{+165}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 10^{+215}:\\
\;\;\;\;\mathsf{fma}\left(b, a, -0.5 \cdot b\right) + \left(x + y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5.80000000000000011e165 or 9.99999999999999907e214 < z Initial program 99.5%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
lower-fma.f64N/A
lower-*.f64N/A
metadata-eval99.5
Applied rewrites99.5%
Taylor expanded in a around 0
sub-negN/A
associate-+l+N/A
associate-+r+N/A
associate-+r+N/A
+-commutativeN/A
mul-1-negN/A
associate-+r+N/A
+-commutativeN/A
associate-+r+N/A
Applied rewrites82.7%
Taylor expanded in z around inf
Applied rewrites72.7%
if -5.80000000000000011e165 < z < 9.99999999999999907e214Initial 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 rewrites99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f6488.2
Applied rewrites88.2%
Final simplification85.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma (- 1.0 (log t)) z x)))
(if (<= z -5.8e+165)
t_1
(if (<= z 2.4e+193) (+ (fma b a (* -0.5 b)) (+ x y)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma((1.0 - log(t)), z, x);
double tmp;
if (z <= -5.8e+165) {
tmp = t_1;
} else if (z <= 2.4e+193) {
tmp = fma(b, a, (-0.5 * b)) + (x + y);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(Float64(1.0 - log(t)), z, x) tmp = 0.0 if (z <= -5.8e+165) tmp = t_1; elseif (z <= 2.4e+193) tmp = Float64(fma(b, a, Float64(-0.5 * b)) + Float64(x + y)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision] * z + x), $MachinePrecision]}, If[LessEqual[z, -5.8e+165], t$95$1, If[LessEqual[z, 2.4e+193], N[(N[(b * a + N[(-0.5 * b), $MachinePrecision]), $MachinePrecision] + N[(x + y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(1 - \log t, z, x\right)\\
\mathbf{if}\;z \leq -5.8 \cdot 10^{+165}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.4 \cdot 10^{+193}:\\
\;\;\;\;\mathsf{fma}\left(b, a, -0.5 \cdot b\right) + \left(x + y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5.80000000000000011e165 or 2.4e193 < z Initial program 99.5%
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
*-rgt-identityN/A
distribute-lft-inN/A
+-commutativeN/A
log-recN/A
sub-negN/A
*-commutativeN/A
sub-negN/A
mul-1-negN/A
lower-fma.f64N/A
Applied rewrites96.4%
Taylor expanded in b around 0
Applied rewrites72.9%
if -5.80000000000000011e165 < z < 2.4e193Initial 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 rewrites99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f6488.9
Applied rewrites88.9%
Final simplification86.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- 1.0 (log t)) z)))
(if (<= z -8.5e+165)
t_1
(if (<= z 1e+215) (+ (fma b a (* -0.5 b)) (+ x y)) 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 <= -8.5e+165) {
tmp = t_1;
} else if (z <= 1e+215) {
tmp = fma(b, a, (-0.5 * b)) + (x + y);
} 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 <= -8.5e+165) tmp = t_1; elseif (z <= 1e+215) tmp = Float64(fma(b, a, Float64(-0.5 * b)) + Float64(x + y)); else tmp = t_1; end return 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, -8.5e+165], t$95$1, If[LessEqual[z, 1e+215], N[(N[(b * a + N[(-0.5 * b), $MachinePrecision]), $MachinePrecision] + N[(x + y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(1 - \log t\right) \cdot z\\
\mathbf{if}\;z \leq -8.5 \cdot 10^{+165}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 10^{+215}:\\
\;\;\;\;\mathsf{fma}\left(b, a, -0.5 \cdot b\right) + \left(x + y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -8.5000000000000001e165 or 9.99999999999999907e214 < z Initial program 99.5%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
lower-fma.f64N/A
lower-*.f64N/A
metadata-eval99.5
Applied rewrites99.5%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6469.9
Applied rewrites69.9%
if -8.5000000000000001e165 < z < 9.99999999999999907e214Initial 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 rewrites99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f6488.2
Applied rewrites88.2%
Final simplification85.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (- z (* (log t) z))))
(if (<= z -8.5e+165)
t_1
(if (<= z 1e+215) (+ (fma b a (* -0.5 b)) (+ x y)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = z - (log(t) * z);
double tmp;
if (z <= -8.5e+165) {
tmp = t_1;
} else if (z <= 1e+215) {
tmp = fma(b, a, (-0.5 * b)) + (x + y);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(z - Float64(log(t) * z)) tmp = 0.0 if (z <= -8.5e+165) tmp = t_1; elseif (z <= 1e+215) tmp = Float64(fma(b, a, Float64(-0.5 * b)) + 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[(N[Log[t], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -8.5e+165], t$95$1, If[LessEqual[z, 1e+215], N[(N[(b * a + N[(-0.5 * b), $MachinePrecision]), $MachinePrecision] + N[(x + y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z - \log t \cdot z\\
\mathbf{if}\;z \leq -8.5 \cdot 10^{+165}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 10^{+215}:\\
\;\;\;\;\mathsf{fma}\left(b, a, -0.5 \cdot b\right) + \left(x + y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -8.5000000000000001e165 or 9.99999999999999907e214 < z Initial program 99.5%
Taylor expanded in z around inf
sub-negN/A
log-recN/A
distribute-lft-inN/A
*-rgt-identityN/A
remove-double-negN/A
mul-1-negN/A
sub-negN/A
lower--.f64N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
log-recN/A
remove-double-negN/A
*-commutativeN/A
lower-*.f64N/A
lower-log.f6469.6
Applied rewrites69.6%
if -8.5000000000000001e165 < z < 9.99999999999999907e214Initial 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 rewrites99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f6488.2
Applied rewrites88.2%
Final simplification85.4%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* b (- a 0.5))) (t_2 (fma (- a 0.5) b x))) (if (<= t_1 -1e+69) t_2 (if (<= t_1 6e+105) (+ (fma -0.5 b 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((a - 0.5), b, x);
double tmp;
if (t_1 <= -1e+69) {
tmp = t_2;
} else if (t_1 <= 6e+105) {
tmp = fma(-0.5, b, 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 = fma(Float64(a - 0.5), b, x) tmp = 0.0 if (t_1 <= -1e+69) tmp = t_2; elseif (t_1 <= 6e+105) tmp = Float64(fma(-0.5, b, 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[(a - 0.5), $MachinePrecision] * b + x), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+69], t$95$2, If[LessEqual[t$95$1, 6e+105], N[(N[(-0.5 * b + x), $MachinePrecision] + y), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := b \cdot \left(a - 0.5\right)\\
t_2 := \mathsf{fma}\left(a - 0.5, b, x\right)\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+69}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 6 \cdot 10^{+105}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, b, x\right) + y\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < -1.0000000000000001e69 or 6.0000000000000001e105 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) Initial 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
*-rgt-identityN/A
distribute-lft-inN/A
+-commutativeN/A
log-recN/A
sub-negN/A
*-commutativeN/A
sub-negN/A
mul-1-negN/A
lower-fma.f64N/A
Applied rewrites89.5%
Taylor expanded in z around 0
Applied rewrites79.6%
if -1.0000000000000001e69 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < 6.0000000000000001e105Initial 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.8
Applied rewrites99.8%
Taylor expanded in a around 0
sub-negN/A
associate-+l+N/A
associate-+r+N/A
associate-+r+N/A
+-commutativeN/A
mul-1-negN/A
associate-+r+N/A
+-commutativeN/A
associate-+r+N/A
Applied rewrites95.2%
Taylor expanded in z around 0
Applied rewrites64.3%
Final simplification71.8%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* b (- a 0.5)))) (if (<= t_1 -1e+69) t_1 (if (<= t_1 6e+105) (+ (* -0.5 b) y) 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 <= -1e+69) {
tmp = t_1;
} else if (t_1 <= 6e+105) {
tmp = (-0.5 * b) + y;
} 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 = b * (a - 0.5d0)
if (t_1 <= (-1d+69)) then
tmp = t_1
else if (t_1 <= 6d+105) then
tmp = ((-0.5d0) * b) + y
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 = b * (a - 0.5);
double tmp;
if (t_1 <= -1e+69) {
tmp = t_1;
} else if (t_1 <= 6e+105) {
tmp = (-0.5 * b) + y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = b * (a - 0.5) tmp = 0 if t_1 <= -1e+69: tmp = t_1 elif t_1 <= 6e+105: tmp = (-0.5 * b) + y 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 <= -1e+69) tmp = t_1; elseif (t_1 <= 6e+105) tmp = Float64(Float64(-0.5 * b) + y); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = b * (a - 0.5); tmp = 0.0; if (t_1 <= -1e+69) tmp = t_1; elseif (t_1 <= 6e+105) tmp = (-0.5 * b) + y; else tmp = t_1; end tmp_2 = 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, -1e+69], t$95$1, If[LessEqual[t$95$1, 6e+105], N[(N[(-0.5 * b), $MachinePrecision] + y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := b \cdot \left(a - 0.5\right)\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+69}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_1 \leq 6 \cdot 10^{+105}:\\
\;\;\;\;-0.5 \cdot b + y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < -1.0000000000000001e69 or 6.0000000000000001e105 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) Initial program 99.9%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6473.3
Applied rewrites73.3%
if -1.0000000000000001e69 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < 6.0000000000000001e105Initial 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.8
Applied rewrites99.8%
Taylor expanded in a around 0
sub-negN/A
associate-+l+N/A
associate-+r+N/A
associate-+r+N/A
+-commutativeN/A
mul-1-negN/A
associate-+r+N/A
+-commutativeN/A
associate-+r+N/A
Applied rewrites95.2%
Taylor expanded in b around inf
Applied rewrites34.1%
Final simplification53.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (* b a) (+ x y))))
(if (<= a -2300000000000.0)
t_1
(if (<= a 4.1e+17) (+ (fma -0.5 b x) y) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (b * a) + (x + y);
double tmp;
if (a <= -2300000000000.0) {
tmp = t_1;
} else if (a <= 4.1e+17) {
tmp = fma(-0.5, b, x) + y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(b * a) + Float64(x + y)) tmp = 0.0 if (a <= -2300000000000.0) tmp = t_1; elseif (a <= 4.1e+17) tmp = Float64(fma(-0.5, b, x) + y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(b * a), $MachinePrecision] + N[(x + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -2300000000000.0], t$95$1, If[LessEqual[a, 4.1e+17], N[(N[(-0.5 * b + x), $MachinePrecision] + y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := b \cdot a + \left(x + y\right)\\
\mathbf{if}\;a \leq -2300000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 4.1 \cdot 10^{+17}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, b, x\right) + y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -2.3e12 or 4.1e17 < a 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 rewrites99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f6481.9
Applied rewrites81.9%
Taylor expanded in a around inf
lower-*.f6481.9
Applied rewrites81.9%
if -2.3e12 < a < 4.1e17Initial 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 rewrites99.9%
Taylor expanded in a around 0
sub-negN/A
associate-+l+N/A
associate-+r+N/A
associate-+r+N/A
+-commutativeN/A
mul-1-negN/A
associate-+r+N/A
+-commutativeN/A
associate-+r+N/A
Applied rewrites98.6%
Taylor expanded in z around 0
Applied rewrites75.1%
Final simplification78.1%
(FPCore (x y z t a b) :precision binary64 (if (<= (- a 0.5) -2000000000000.0) (* b a) (if (<= (- a 0.5) 500.0) (* -0.5 b) (* b a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a - 0.5) <= -2000000000000.0) {
tmp = b * a;
} else if ((a - 0.5) <= 500.0) {
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 - 0.5d0) <= (-2000000000000.0d0)) then
tmp = b * a
else if ((a - 0.5d0) <= 500.0d0) 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 - 0.5) <= -2000000000000.0) {
tmp = b * a;
} else if ((a - 0.5) <= 500.0) {
tmp = -0.5 * b;
} else {
tmp = b * a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a - 0.5) <= -2000000000000.0: tmp = b * a elif (a - 0.5) <= 500.0: tmp = -0.5 * b else: tmp = b * a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(a - 0.5) <= -2000000000000.0) tmp = Float64(b * a); elseif (Float64(a - 0.5) <= 500.0) 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 - 0.5) <= -2000000000000.0) tmp = b * a; elseif ((a - 0.5) <= 500.0) tmp = -0.5 * b; else tmp = b * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(a - 0.5), $MachinePrecision], -2000000000000.0], N[(b * a), $MachinePrecision], If[LessEqual[N[(a - 0.5), $MachinePrecision], 500.0], N[(-0.5 * b), $MachinePrecision], N[(b * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a - 0.5 \leq -2000000000000:\\
\;\;\;\;b \cdot a\\
\mathbf{elif}\;a - 0.5 \leq 500:\\
\;\;\;\;-0.5 \cdot b\\
\mathbf{else}:\\
\;\;\;\;b \cdot a\\
\end{array}
\end{array}
if (-.f64 a #s(literal 1/2 binary64)) < -2e12 or 500 < (-.f64 a #s(literal 1/2 binary64)) Initial program 99.9%
Taylor expanded in a around inf
lower-*.f6452.0
Applied rewrites52.0%
if -2e12 < (-.f64 a #s(literal 1/2 binary64)) < 500Initial 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 rewrites99.9%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6429.0
Applied rewrites29.0%
Taylor expanded in a around 0
Applied rewrites27.7%
Final simplification39.1%
(FPCore (x y z t a b) :precision binary64 (+ (fma b a (* -0.5 b)) (+ x y)))
double code(double x, double y, double z, double t, double a, double b) {
return fma(b, a, (-0.5 * b)) + (x + y);
}
function code(x, y, z, t, a, b) return Float64(fma(b, a, Float64(-0.5 * b)) + Float64(x + y)) end
code[x_, y_, z_, t_, a_, b_] := N[(N[(b * a + N[(-0.5 * b), $MachinePrecision]), $MachinePrecision] + N[(x + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(b, a, -0.5 \cdot b\right) + \left(x + y\right)
\end{array}
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 rewrites99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f6478.8
Applied rewrites78.8%
Final simplification78.8%
(FPCore (x y z t a b) :precision binary64 (fma (- a 0.5) b (+ x y)))
double code(double x, double y, double z, double t, double a, double b) {
return fma((a - 0.5), b, (x + y));
}
function code(x, y, z, t, a, b) return fma(Float64(a - 0.5), b, Float64(x + y)) end
code[x_, y_, z_, t_, a_, b_] := N[(N[(a - 0.5), $MachinePrecision] * b + N[(x + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(a - 0.5, b, x + y\right)
\end{array}
Initial program 99.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6499.9
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.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
lower-+.f6478.8
Applied rewrites78.8%
Final simplification78.8%
(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 Float64(fma(Float64(a - 0.5), b, y) + x) end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(a - 0.5), $MachinePrecision] * b + y), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(a - 0.5, b, y\right) + x
\end{array}
Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6478.8
Applied rewrites78.8%
(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--.f6439.8
Applied rewrites39.8%
Final simplification39.8%
(FPCore (x y z t a b) :precision binary64 (* b a))
double code(double x, double y, double z, double t, double a, double b) {
return b * a;
}
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
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return b * a;
}
def code(x, y, z, t, a, b): return b * a
function code(x, y, z, t, a, b) return Float64(b * a) end
function tmp = code(x, y, z, t, a, b) tmp = b * a; end
code[x_, y_, z_, t_, a_, b_] := N[(b * a), $MachinePrecision]
\begin{array}{l}
\\
b \cdot a
\end{array}
Initial program 99.9%
Taylor expanded in a around inf
lower-*.f6425.6
Applied rewrites25.6%
Final simplification25.6%
(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 2024243
(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)))