
(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 17 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 b -0.5 (fma a b (fma (- z) (log t) (+ z (+ y x))))))
double code(double x, double y, double z, double t, double a, double b) {
return fma(b, -0.5, fma(a, b, fma(-z, log(t), (z + (y + x)))));
}
function code(x, y, z, t, a, b) return fma(b, -0.5, fma(a, b, fma(Float64(-z), log(t), Float64(z + Float64(y + x))))) end
code[x_, y_, z_, t_, a_, b_] := N[(b * -0.5 + N[(a * b + N[((-z) * N[Log[t], $MachinePrecision] + N[(z + N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(b, -0.5, \mathsf{fma}\left(a, b, \mathsf{fma}\left(-z, \log t, z + \left(y + x\right)\right)\right)\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%
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-+r+N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.9
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
Applied rewrites99.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (- (+ (+ x y) z) (* z (log t))) (* (- a 0.5) b))))
(if (<= t_1 -4.5e+307)
(* b a)
(if (<= t_1 -1e-102)
(fma -0.5 b x)
(if (<= t_1 2e+302) (fma -0.5 b y) (* b a))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (((x + y) + z) - (z * log(t))) + ((a - 0.5) * b);
double tmp;
if (t_1 <= -4.5e+307) {
tmp = b * a;
} else if (t_1 <= -1e-102) {
tmp = fma(-0.5, b, x);
} else if (t_1 <= 2e+302) {
tmp = fma(-0.5, b, y);
} else {
tmp = b * a;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(Float64(x + y) + z) - Float64(z * log(t))) + Float64(Float64(a - 0.5) * b)) tmp = 0.0 if (t_1 <= -4.5e+307) tmp = Float64(b * a); elseif (t_1 <= -1e-102) tmp = fma(-0.5, b, x); elseif (t_1 <= 2e+302) tmp = fma(-0.5, b, y); else tmp = Float64(b * a); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = 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]}, If[LessEqual[t$95$1, -4.5e+307], N[(b * a), $MachinePrecision], If[LessEqual[t$95$1, -1e-102], N[(-0.5 * b + x), $MachinePrecision], If[LessEqual[t$95$1, 2e+302], N[(-0.5 * b + y), $MachinePrecision], N[(b * a), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b\\
\mathbf{if}\;t\_1 \leq -4.5 \cdot 10^{+307}:\\
\;\;\;\;b \cdot a\\
\mathbf{elif}\;t\_1 \leq -1 \cdot 10^{-102}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, b, x\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+302}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, b, y\right)\\
\mathbf{else}:\\
\;\;\;\;b \cdot a\\
\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)) < -4.50000000000000025e307 or 2.0000000000000002e302 < (+.f64 (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t))) (*.f64 (-.f64 a #s(literal 1/2 binary64)) b)) Initial program 100.0%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f6492.1
Applied rewrites92.1%
if -4.50000000000000025e307 < (+.f64 (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t))) (*.f64 (-.f64 a #s(literal 1/2 binary64)) b)) < -9.99999999999999933e-103Initial 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 rewrites83.0%
Taylor expanded in z around 0
Applied rewrites60.6%
Taylor expanded in y around 0
Applied rewrites35.6%
if -9.99999999999999933e-103 < (+.f64 (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t))) (*.f64 (-.f64 a #s(literal 1/2 binary64)) b)) < 2.0000000000000002e302Initial 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 rewrites80.8%
Taylor expanded in z around 0
Applied rewrites62.8%
Taylor expanded in x around 0
Applied rewrites37.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- a 0.5) b)))
(if (or (<= t_1 -5e+128) (not (<= t_1 1e+40)))
(fma (- a 0.5) b (+ y x))
(+ (fma (- 1.0 (log t)) z x) y))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a - 0.5) * b;
double tmp;
if ((t_1 <= -5e+128) || !(t_1 <= 1e+40)) {
tmp = fma((a - 0.5), b, (y + x));
} else {
tmp = fma((1.0 - log(t)), z, x) + y;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a - 0.5) * b) tmp = 0.0 if ((t_1 <= -5e+128) || !(t_1 <= 1e+40)) tmp = fma(Float64(a - 0.5), b, Float64(y + x)); else tmp = Float64(fma(Float64(1.0 - log(t)), z, x) + y); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -5e+128], N[Not[LessEqual[t$95$1, 1e+40]], $MachinePrecision]], N[(N[(a - 0.5), $MachinePrecision] * b + N[(y + x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision] * z + x), $MachinePrecision] + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a - 0.5\right) \cdot b\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+128} \lor \neg \left(t\_1 \leq 10^{+40}\right):\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, y + x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 - \log t, z, x\right) + y\\
\end{array}
\end{array}
if (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < -5e128 or 1.00000000000000003e40 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) 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-+.f6491.0
Applied rewrites91.0%
if -5e128 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < 1.00000000000000003e40Initial 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.7%
Taylor expanded in z around 0
Applied rewrites69.6%
Taylor expanded in b around 0
associate-+r+N/A
associate--l+N/A
unsub-negN/A
+-commutativeN/A
unsub-negN/A
*-rgt-identityN/A
distribute-lft-out--N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f6492.8
Applied rewrites92.8%
Applied rewrites92.8%
Final simplification91.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= (- a 0.5) -4.0) (not (<= (- a 0.5) 4e+59))) (fma (- a 0.5) b (+ y x)) (+ (fma (- 1.0 (log t)) z y) (fma -0.5 b x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((a - 0.5) <= -4.0) || !((a - 0.5) <= 4e+59)) {
tmp = fma((a - 0.5), b, (y + x));
} else {
tmp = fma((1.0 - log(t)), z, y) + fma(-0.5, b, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((Float64(a - 0.5) <= -4.0) || !(Float64(a - 0.5) <= 4e+59)) tmp = fma(Float64(a - 0.5), b, Float64(y + x)); else tmp = Float64(fma(Float64(1.0 - log(t)), z, y) + fma(-0.5, b, x)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[N[(a - 0.5), $MachinePrecision], -4.0], N[Not[LessEqual[N[(a - 0.5), $MachinePrecision], 4e+59]], $MachinePrecision]], N[(N[(a - 0.5), $MachinePrecision] * b + N[(y + x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision] * z + y), $MachinePrecision] + N[(-0.5 * b + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a - 0.5 \leq -4 \lor \neg \left(a - 0.5 \leq 4 \cdot 10^{+59}\right):\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, y + x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 - \log t, z, y\right) + \mathsf{fma}\left(-0.5, b, x\right)\\
\end{array}
\end{array}
if (-.f64 a #s(literal 1/2 binary64)) < -4 or 3.99999999999999989e59 < (-.f64 a #s(literal 1/2 binary64)) 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-+.f6491.9
Applied rewrites91.9%
if -4 < (-.f64 a #s(literal 1/2 binary64)) < 3.99999999999999989e59Initial 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 rewrites98.5%
Final simplification95.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (- 1.0 (log t))))
(if (<= (- a 0.5) -4.0)
(fma (- a 0.5) b (+ y x))
(if (<= (- a 0.5) 5e+37)
(+ (fma t_1 z y) (fma -0.5 b x))
(fma t_1 z (fma (- a 0.5) b x))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = 1.0 - log(t);
double tmp;
if ((a - 0.5) <= -4.0) {
tmp = fma((a - 0.5), b, (y + x));
} else if ((a - 0.5) <= 5e+37) {
tmp = fma(t_1, z, y) + fma(-0.5, b, x);
} else {
tmp = fma(t_1, z, fma((a - 0.5), b, x));
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(1.0 - log(t)) tmp = 0.0 if (Float64(a - 0.5) <= -4.0) tmp = fma(Float64(a - 0.5), b, Float64(y + x)); elseif (Float64(a - 0.5) <= 5e+37) tmp = Float64(fma(t_1, z, y) + fma(-0.5, b, x)); else tmp = fma(t_1, z, fma(Float64(a - 0.5), b, x)); 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[(a - 0.5), $MachinePrecision], -4.0], N[(N[(a - 0.5), $MachinePrecision] * b + N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a - 0.5), $MachinePrecision], 5e+37], N[(N[(t$95$1 * z + y), $MachinePrecision] + N[(-0.5 * b + x), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * z + N[(N[(a - 0.5), $MachinePrecision] * b + x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 1 - \log t\\
\mathbf{if}\;a - 0.5 \leq -4:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, y + x\right)\\
\mathbf{elif}\;a - 0.5 \leq 5 \cdot 10^{+37}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, z, y\right) + \mathsf{fma}\left(-0.5, b, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, z, \mathsf{fma}\left(a - 0.5, b, x\right)\right)\\
\end{array}
\end{array}
if (-.f64 a #s(literal 1/2 binary64)) < -4Initial 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-+.f6493.3
Applied rewrites93.3%
if -4 < (-.f64 a #s(literal 1/2 binary64)) < 4.99999999999999989e37Initial 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.1%
if 4.99999999999999989e37 < (-.f64 a #s(literal 1/2 binary64)) Initial 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 rewrites87.5%
(FPCore (x y z t a b) :precision binary64 (if (<= (- (+ (+ x y) z) (* z (log t))) -1e-102) (fma (- a 0.5) b x) (fma (- a 0.5) b y)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((((x + y) + z) - (z * log(t))) <= -1e-102) {
tmp = fma((a - 0.5), b, x);
} else {
tmp = fma((a - 0.5), b, y);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(Float64(Float64(x + y) + z) - Float64(z * log(t))) <= -1e-102) tmp = fma(Float64(a - 0.5), b, x); else tmp = fma(Float64(a - 0.5), b, y); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(N[(N[(x + y), $MachinePrecision] + z), $MachinePrecision] - N[(z * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1e-102], N[(N[(a - 0.5), $MachinePrecision] * b + x), $MachinePrecision], N[(N[(a - 0.5), $MachinePrecision] * b + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(\left(x + y\right) + z\right) - z \cdot \log t \leq -1 \cdot 10^{-102}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, y\right)\\
\end{array}
\end{array}
if (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t))) < -9.99999999999999933e-103Initial 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
associate-+r+N/A
distribute-rgt-outN/A
+-commutativeN/A
metadata-evalN/A
sub-negN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f6481.4
Applied rewrites81.4%
Taylor expanded in y around 0
Applied rewrites60.2%
if -9.99999999999999933e-103 < (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t))) 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.8
Applied rewrites99.8%
Taylor expanded in z around 0
associate-+r+N/A
distribute-rgt-outN/A
+-commutativeN/A
metadata-evalN/A
sub-negN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f6480.9
Applied rewrites80.9%
Taylor expanded in x around 0
Applied rewrites58.5%
Final simplification59.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (- 1.0 (log t))))
(if (<= (+ x y) -1e-102)
(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-102) {
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-102) 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-102], 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^{-102}:\\
\;\;\;\;\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) < -9.99999999999999933e-103Initial 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 rewrites76.3%
if -9.99999999999999933e-103 < (+.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
+-commutativeN/A
associate-+l+N/A
+-commutativeN/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 rewrites77.0%
(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}
Initial program 99.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (- 1.0 (log t))))
(if (<= z -6.5e+174)
(fma t_1 z y)
(if (<= z 8.2e+119) (fma (- a 0.5) b (+ y x)) (fma t_1 z x)))))
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 <= -6.5e+174) {
tmp = fma(t_1, z, y);
} else if (z <= 8.2e+119) {
tmp = fma((a - 0.5), b, (y + x));
} else {
tmp = fma(t_1, z, x);
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(1.0 - log(t)) tmp = 0.0 if (z <= -6.5e+174) tmp = fma(t_1, z, y); elseif (z <= 8.2e+119) tmp = fma(Float64(a - 0.5), b, Float64(y + x)); else tmp = fma(t_1, z, x); 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, -6.5e+174], N[(t$95$1 * z + y), $MachinePrecision], If[LessEqual[z, 8.2e+119], N[(N[(a - 0.5), $MachinePrecision] * b + N[(y + x), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * z + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 1 - \log t\\
\mathbf{if}\;z \leq -6.5 \cdot 10^{+174}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, z, y\right)\\
\mathbf{elif}\;z \leq 8.2 \cdot 10^{+119}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, y + x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, z, x\right)\\
\end{array}
\end{array}
if z < -6.5000000000000001e174Initial program 99.7%
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 rewrites86.2%
Taylor expanded in z around 0
Applied rewrites31.3%
Taylor expanded in b around 0
associate-+r+N/A
associate--l+N/A
unsub-negN/A
+-commutativeN/A
unsub-negN/A
*-rgt-identityN/A
distribute-lft-out--N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f6486.1
Applied rewrites86.1%
Taylor expanded in x around 0
Applied rewrites63.9%
if -6.5000000000000001e174 < z < 8.1999999999999994e119Initial 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-+.f6493.0
Applied rewrites93.0%
if 8.1999999999999994e119 < z Initial program 99.6%
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 rewrites84.5%
Taylor expanded in z around 0
Applied rewrites28.7%
Taylor expanded in b around 0
associate-+r+N/A
associate--l+N/A
unsub-negN/A
+-commutativeN/A
unsub-negN/A
*-rgt-identityN/A
distribute-lft-out--N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f6482.3
Applied rewrites82.3%
Taylor expanded in y around 0
Applied rewrites72.2%
(FPCore (x y z t a b) :precision binary64 (if (<= z 8.2e+119) (fma (- a 0.5) b (+ y x)) (fma (- 1.0 (log t)) z x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= 8.2e+119) {
tmp = fma((a - 0.5), b, (y + x));
} else {
tmp = fma((1.0 - log(t)), z, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= 8.2e+119) tmp = fma(Float64(a - 0.5), b, Float64(y + x)); else tmp = fma(Float64(1.0 - log(t)), z, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, 8.2e+119], N[(N[(a - 0.5), $MachinePrecision] * b + N[(y + x), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision] * z + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 8.2 \cdot 10^{+119}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, y + x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 - \log t, z, x\right)\\
\end{array}
\end{array}
if z < 8.1999999999999994e119Initial 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-+.f6488.5
Applied rewrites88.5%
if 8.1999999999999994e119 < z Initial program 99.6%
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 rewrites84.5%
Taylor expanded in z around 0
Applied rewrites28.7%
Taylor expanded in b around 0
associate-+r+N/A
associate--l+N/A
unsub-negN/A
+-commutativeN/A
unsub-negN/A
*-rgt-identityN/A
distribute-lft-out--N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f6482.3
Applied rewrites82.3%
Taylor expanded in y around 0
Applied rewrites72.2%
(FPCore (x y z t a b) :precision binary64 (if (<= z 2.3e+180) (fma (- a 0.5) b (+ y x)) (* (- 1.0 (log t)) z)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= 2.3e+180) {
tmp = fma((a - 0.5), b, (y + x));
} else {
tmp = (1.0 - log(t)) * z;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= 2.3e+180) tmp = fma(Float64(a - 0.5), b, Float64(y + x)); else tmp = Float64(Float64(1.0 - log(t)) * z); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, 2.3e+180], N[(N[(a - 0.5), $MachinePrecision] * b + N[(y + x), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2.3 \cdot 10^{+180}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, y + x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - \log t\right) \cdot z\\
\end{array}
\end{array}
if z < 2.2999999999999999e180Initial 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-+.f6487.7
Applied rewrites87.7%
if 2.2999999999999999e180 < z Initial program 99.6%
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.f6462.4
Applied rewrites62.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- a 0.5) b)))
(if (or (<= t_1 -1e+116) (not (<= t_1 5e+199)))
(fma (- a 0.5) b x)
(fma -0.5 b (+ y x)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a - 0.5) * b;
double tmp;
if ((t_1 <= -1e+116) || !(t_1 <= 5e+199)) {
tmp = fma((a - 0.5), b, x);
} else {
tmp = fma(-0.5, b, (y + x));
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a - 0.5) * b) tmp = 0.0 if ((t_1 <= -1e+116) || !(t_1 <= 5e+199)) tmp = fma(Float64(a - 0.5), b, x); else tmp = fma(-0.5, b, Float64(y + x)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -1e+116], N[Not[LessEqual[t$95$1, 5e+199]], $MachinePrecision]], N[(N[(a - 0.5), $MachinePrecision] * b + x), $MachinePrecision], N[(-0.5 * b + N[(y + x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a - 0.5\right) \cdot b\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+116} \lor \neg \left(t\_1 \leq 5 \cdot 10^{+199}\right):\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, b, y + x\right)\\
\end{array}
\end{array}
if (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < -1.00000000000000002e116 or 4.9999999999999998e199 < (*.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 rewrites99.9%
Taylor expanded in z around 0
associate-+r+N/A
distribute-rgt-outN/A
+-commutativeN/A
metadata-evalN/A
sub-negN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f6491.9
Applied rewrites91.9%
Taylor expanded in y around 0
Applied rewrites85.5%
if -1.00000000000000002e116 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < 4.9999999999999998e199Initial 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 rewrites95.6%
Taylor expanded in z around 0
Applied rewrites69.9%
Final simplification76.1%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (- a 0.5) b))) (if (or (<= t_1 -5e+128) (not (<= t_1 2e+229))) t_1 (fma -0.5 b (+ y x)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a - 0.5) * b;
double tmp;
if ((t_1 <= -5e+128) || !(t_1 <= 2e+229)) {
tmp = t_1;
} else {
tmp = fma(-0.5, b, (y + x));
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a - 0.5) * b) tmp = 0.0 if ((t_1 <= -5e+128) || !(t_1 <= 2e+229)) tmp = t_1; else tmp = fma(-0.5, b, Float64(y + x)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -5e+128], N[Not[LessEqual[t$95$1, 2e+229]], $MachinePrecision]], t$95$1, N[(-0.5 * b + N[(y + x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a - 0.5\right) \cdot b\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+128} \lor \neg \left(t\_1 \leq 2 \cdot 10^{+229}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, b, y + x\right)\\
\end{array}
\end{array}
if (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < -5e128 or 2e229 < (*.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 rewrites99.9%
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-+r+N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.9
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
Applied rewrites99.9%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6482.2
Applied rewrites82.2%
if -5e128 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < 2e229Initial 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 rewrites94.2%
Taylor expanded in z around 0
Applied rewrites68.9%
Final simplification73.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -1.05e+31) (not (<= a 2e+60))) (* b a) (fma -0.5 b x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -1.05e+31) || !(a <= 2e+60)) {
tmp = b * a;
} else {
tmp = fma(-0.5, b, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -1.05e+31) || !(a <= 2e+60)) tmp = Float64(b * a); else tmp = fma(-0.5, b, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -1.05e+31], N[Not[LessEqual[a, 2e+60]], $MachinePrecision]], N[(b * a), $MachinePrecision], N[(-0.5 * b + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.05 \cdot 10^{+31} \lor \neg \left(a \leq 2 \cdot 10^{+60}\right):\\
\;\;\;\;b \cdot a\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, b, x\right)\\
\end{array}
\end{array}
if a < -1.04999999999999989e31 or 1.9999999999999999e60 < a Initial program 99.9%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f6466.5
Applied rewrites66.5%
if -1.04999999999999989e31 < a < 1.9999999999999999e60Initial 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.4%
Taylor expanded in z around 0
Applied rewrites71.5%
Taylor expanded in y around 0
Applied rewrites46.9%
Final simplification55.0%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -3.8e-7) (not (<= a 3.7e+37))) (* b a) (* -0.5 b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -3.8e-7) || !(a <= 3.7e+37)) {
tmp = b * a;
} else {
tmp = -0.5 * b;
}
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 <= (-3.8d-7)) .or. (.not. (a <= 3.7d+37))) then
tmp = b * a
else
tmp = (-0.5d0) * b
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 <= -3.8e-7) || !(a <= 3.7e+37)) {
tmp = b * a;
} else {
tmp = -0.5 * b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a <= -3.8e-7) or not (a <= 3.7e+37): tmp = b * a else: tmp = -0.5 * b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -3.8e-7) || !(a <= 3.7e+37)) tmp = Float64(b * a); else tmp = Float64(-0.5 * b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((a <= -3.8e-7) || ~((a <= 3.7e+37))) tmp = b * a; else tmp = -0.5 * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -3.8e-7], N[Not[LessEqual[a, 3.7e+37]], $MachinePrecision]], N[(b * a), $MachinePrecision], N[(-0.5 * b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.8 \cdot 10^{-7} \lor \neg \left(a \leq 3.7 \cdot 10^{+37}\right):\\
\;\;\;\;b \cdot a\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot b\\
\end{array}
\end{array}
if a < -3.80000000000000015e-7 or 3.6999999999999999e37 < a Initial program 99.9%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f6460.8
Applied rewrites60.8%
if -3.80000000000000015e-7 < a < 3.6999999999999999e37Initial 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.1%
Taylor expanded in z around 0
Applied rewrites72.2%
Taylor expanded in y around 0
Applied rewrites46.6%
Taylor expanded in x around 0
Applied rewrites19.5%
Final simplification38.7%
(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-+.f6481.2
Applied rewrites81.2%
(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 rewrites71.8%
Taylor expanded in z around 0
Applied rewrites53.5%
Taylor expanded in y around 0
Applied rewrites32.8%
Taylor expanded in x around 0
Applied rewrites11.9%
(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 2024313
(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)))