
(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}
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (- 1.0 (log t))))
(if (<= (+ y x) -2e-143)
(fma t_1 z (fma (- a 0.5) b x))
(+ (fma t_1 z y) (* b (- a 0.5))))))assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = 1.0 - log(t);
double tmp;
if ((y + x) <= -2e-143) {
tmp = fma(t_1, z, fma((a - 0.5), b, x));
} else {
tmp = fma(t_1, z, y) + (b * (a - 0.5));
}
return tmp;
}
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) t_1 = Float64(1.0 - log(t)) tmp = 0.0 if (Float64(y + x) <= -2e-143) tmp = fma(t_1, z, fma(Float64(a - 0.5), b, x)); else tmp = Float64(fma(t_1, z, y) + Float64(b * Float64(a - 0.5))); end return tmp end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(y + x), $MachinePrecision], -2e-143], N[(t$95$1 * z + N[(N[(a - 0.5), $MachinePrecision] * b + x), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 * z + y), $MachinePrecision] + N[(b * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := 1 - \log t\\
\mathbf{if}\;y + x \leq -2 \cdot 10^{-143}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, z, \mathsf{fma}\left(a - 0.5, b, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, z, y\right) + b \cdot \left(a - 0.5\right)\\
\end{array}
\end{array}
if (+.f64 x y) < -1.9999999999999999e-143Initial 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
Applied rewrites74.0%
if -1.9999999999999999e-143 < (+.f64 x y) Initial program 99.8%
Taylor expanded in x around 0
cancel-sign-sub-invN/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.f6478.7
Applied rewrites78.7%
Final simplification76.5%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* b (- a 0.5))) (t_2 (+ (fma (- a 0.5) b y) x)))
(if (<= t_1 -5e+115)
t_2
(if (<= t_1 5e-46) (+ (fma (- 1.0 (log t)) z x) y) t_2))))assert(x < y && y < z && z < t && t < a && a < b);
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, y) + x;
double tmp;
if (t_1 <= -5e+115) {
tmp = t_2;
} else if (t_1 <= 5e-46) {
tmp = fma((1.0 - log(t)), z, x) + y;
} else {
tmp = t_2;
}
return tmp;
}
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) t_1 = Float64(b * Float64(a - 0.5)) t_2 = Float64(fma(Float64(a - 0.5), b, y) + x) tmp = 0.0 if (t_1 <= -5e+115) tmp = t_2; elseif (t_1 <= 5e-46) tmp = Float64(fma(Float64(1.0 - log(t)), z, x) + y); else tmp = t_2; end return tmp end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
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[(a - 0.5), $MachinePrecision] * b + y), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+115], t$95$2, If[LessEqual[t$95$1, 5e-46], N[(N[(N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision] * z + x), $MachinePrecision] + y), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := b \cdot \left(a - 0.5\right)\\
t_2 := \mathsf{fma}\left(a - 0.5, b, y\right) + x\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+115}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-46}:\\
\;\;\;\;\mathsf{fma}\left(1 - \log t, z, x\right) + y\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < -5.00000000000000008e115 or 4.99999999999999992e-46 < (*.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--.f6488.7
Applied rewrites88.7%
if -5.00000000000000008e115 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < 4.99999999999999992e-46Initial program 99.7%
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-+.f6493.8
Applied rewrites93.8%
Applied rewrites93.8%
Final simplification91.2%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= (+ y x) 1e+97) (fma (- 1.0 (log t)) z (fma (- a 0.5) b x)) (+ (* (- (+ (/ x y) (/ z y)) -1.0) y) (* b (- a 0.5)))))
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y + x) <= 1e+97) {
tmp = fma((1.0 - log(t)), z, fma((a - 0.5), b, x));
} else {
tmp = ((((x / y) + (z / y)) - -1.0) * y) + (b * (a - 0.5));
}
return tmp;
}
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(y + x) <= 1e+97) tmp = fma(Float64(1.0 - log(t)), z, fma(Float64(a - 0.5), b, x)); else tmp = Float64(Float64(Float64(Float64(Float64(x / y) + Float64(z / y)) - -1.0) * y) + Float64(b * Float64(a - 0.5))); end return tmp end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(y + x), $MachinePrecision], 1e+97], N[(N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision] * z + N[(N[(a - 0.5), $MachinePrecision] * b + x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(x / y), $MachinePrecision] + N[(z / y), $MachinePrecision]), $MachinePrecision] - -1.0), $MachinePrecision] * y), $MachinePrecision] + N[(b * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;y + x \leq 10^{+97}:\\
\;\;\;\;\mathsf{fma}\left(1 - \log t, z, \mathsf{fma}\left(a - 0.5, b, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\frac{x}{y} + \frac{z}{y}\right) - -1\right) \cdot y + b \cdot \left(a - 0.5\right)\\
\end{array}
\end{array}
if (+.f64 x y) < 1.0000000000000001e97Initial 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
Applied rewrites81.7%
if 1.0000000000000001e97 < (+.f64 x y) Initial program 99.9%
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.f6483.4
Applied rewrites83.4%
Taylor expanded in z around 0
Applied rewrites73.8%
Final simplification79.6%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (+ (* b (- a 0.5)) (- (+ z (+ y x)) (* (log t) z))))
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
return (b * (a - 0.5)) + ((z + (y + x)) - (log(t) * z));
}
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = (b * (a - 0.5d0)) + ((z + (y + x)) - (log(t) * z))
end function
assert x < y && y < z && z < t && t < a && a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
return (b * (a - 0.5)) + ((z + (y + x)) - (Math.log(t) * z));
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): return (b * (a - 0.5)) + ((z + (y + x)) - (math.log(t) * z))
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) return Float64(Float64(b * Float64(a - 0.5)) + Float64(Float64(z + Float64(y + x)) - Float64(log(t) * z))) end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp = code(x, y, z, t, a, b)
tmp = (b * (a - 0.5)) + ((z + (y + x)) - (log(t) * z));
end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := N[(N[(b * N[(a - 0.5), $MachinePrecision]), $MachinePrecision] + N[(N[(z + N[(y + x), $MachinePrecision]), $MachinePrecision] - N[(N[Log[t], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
b \cdot \left(a - 0.5\right) + \left(\left(z + \left(y + x\right)\right) - \log t \cdot z\right)
\end{array}
Initial program 99.8%
Final simplification99.8%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (- 1.0 (log t))))
(if (<= z -2e+77)
(fma t_1 z x)
(if (<= z 1.16e+162) (+ (fma (- a 0.5) b y) x) (+ (* t_1 z) y)))))assert(x < y && y < z && z < t && t < a && a < b);
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 <= -2e+77) {
tmp = fma(t_1, z, x);
} else if (z <= 1.16e+162) {
tmp = fma((a - 0.5), b, y) + x;
} else {
tmp = (t_1 * z) + y;
}
return tmp;
}
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) t_1 = Float64(1.0 - log(t)) tmp = 0.0 if (z <= -2e+77) tmp = fma(t_1, z, x); elseif (z <= 1.16e+162) tmp = Float64(fma(Float64(a - 0.5), b, y) + x); else tmp = Float64(Float64(t_1 * z) + y); end return tmp end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2e+77], N[(t$95$1 * z + x), $MachinePrecision], If[LessEqual[z, 1.16e+162], N[(N[(N[(a - 0.5), $MachinePrecision] * b + y), $MachinePrecision] + x), $MachinePrecision], N[(N[(t$95$1 * z), $MachinePrecision] + y), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := 1 - \log t\\
\mathbf{if}\;z \leq -2 \cdot 10^{+77}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, z, x\right)\\
\mathbf{elif}\;z \leq 1.16 \cdot 10^{+162}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, y\right) + x\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot z + y\\
\end{array}
\end{array}
if z < -1.99999999999999997e77Initial program 99.6%
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-+.f6485.0
Applied rewrites85.0%
Taylor expanded in y around 0
Applied rewrites79.3%
if -1.99999999999999997e77 < z < 1.16000000000000006e162Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6492.3
Applied rewrites92.3%
if 1.16000000000000006e162 < z Initial program 99.6%
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-+.f6482.4
Applied rewrites82.4%
Taylor expanded in x around 0
Applied rewrites68.3%
Applied rewrites68.3%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (- 1.0 (log t))))
(if (<= z -2e+77)
(fma t_1 z x)
(if (<= z 1.16e+162) (+ (fma (- a 0.5) b y) x) (fma t_1 z y)))))assert(x < y && y < z && z < t && t < a && a < b);
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 <= -2e+77) {
tmp = fma(t_1, z, x);
} else if (z <= 1.16e+162) {
tmp = fma((a - 0.5), b, y) + x;
} else {
tmp = fma(t_1, z, y);
}
return tmp;
}
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) t_1 = Float64(1.0 - log(t)) tmp = 0.0 if (z <= -2e+77) tmp = fma(t_1, z, x); elseif (z <= 1.16e+162) tmp = Float64(fma(Float64(a - 0.5), b, y) + x); else tmp = fma(t_1, z, y); end return tmp end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2e+77], N[(t$95$1 * z + x), $MachinePrecision], If[LessEqual[z, 1.16e+162], N[(N[(N[(a - 0.5), $MachinePrecision] * b + y), $MachinePrecision] + x), $MachinePrecision], N[(t$95$1 * z + y), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := 1 - \log t\\
\mathbf{if}\;z \leq -2 \cdot 10^{+77}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, z, x\right)\\
\mathbf{elif}\;z \leq 1.16 \cdot 10^{+162}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, y\right) + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, z, y\right)\\
\end{array}
\end{array}
if z < -1.99999999999999997e77Initial program 99.6%
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-+.f6485.0
Applied rewrites85.0%
Taylor expanded in y around 0
Applied rewrites79.3%
if -1.99999999999999997e77 < z < 1.16000000000000006e162Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6492.3
Applied rewrites92.3%
if 1.16000000000000006e162 < z Initial program 99.6%
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-+.f6482.4
Applied rewrites82.4%
Taylor expanded in x around 0
Applied rewrites68.3%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (let* ((t_1 (fma (- 1.0 (log t)) z x))) (if (<= z -2e+77) t_1 (if (<= z 2.7e+170) (+ (fma (- a 0.5) b y) x) t_1))))
assert(x < y && y < z && z < t && t < a && a < b);
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 <= -2e+77) {
tmp = t_1;
} else if (z <= 2.7e+170) {
tmp = fma((a - 0.5), b, y) + x;
} else {
tmp = t_1;
}
return tmp;
}
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) t_1 = fma(Float64(1.0 - log(t)), z, x) tmp = 0.0 if (z <= -2e+77) tmp = t_1; elseif (z <= 2.7e+170) tmp = Float64(fma(Float64(a - 0.5), b, y) + x); else tmp = t_1; end return tmp end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
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, -2e+77], t$95$1, If[LessEqual[z, 2.7e+170], N[(N[(N[(a - 0.5), $MachinePrecision] * b + y), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(1 - \log t, z, x\right)\\
\mathbf{if}\;z \leq -2 \cdot 10^{+77}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{+170}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, y\right) + x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.99999999999999997e77 or 2.7000000000000002e170 < z Initial program 99.6%
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-+.f6483.9
Applied rewrites83.9%
Taylor expanded in y around 0
Applied rewrites77.6%
if -1.99999999999999997e77 < z < 2.7000000000000002e170Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6492.3
Applied rewrites92.3%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= z -2e+77) (* (- 1.0 (log t)) z) (if (<= z 4.9e+181) (+ (fma (- a 0.5) b y) x) (- z (* (log t) z)))))
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -2e+77) {
tmp = (1.0 - log(t)) * z;
} else if (z <= 4.9e+181) {
tmp = fma((a - 0.5), b, y) + x;
} else {
tmp = z - (log(t) * z);
}
return tmp;
}
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -2e+77) tmp = Float64(Float64(1.0 - log(t)) * z); elseif (z <= 4.9e+181) tmp = Float64(fma(Float64(a - 0.5), b, y) + x); else tmp = Float64(z - Float64(log(t) * z)); end return tmp end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -2e+77], N[(N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[z, 4.9e+181], N[(N[(N[(a - 0.5), $MachinePrecision] * b + y), $MachinePrecision] + x), $MachinePrecision], N[(z - N[(N[Log[t], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2 \cdot 10^{+77}:\\
\;\;\;\;\left(1 - \log t\right) \cdot z\\
\mathbf{elif}\;z \leq 4.9 \cdot 10^{+181}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, y\right) + x\\
\mathbf{else}:\\
\;\;\;\;z - \log t \cdot z\\
\end{array}
\end{array}
if z < -1.99999999999999997e77Initial program 99.6%
Taylor expanded in x around inf
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-/.f6495.8
Applied rewrites95.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6471.3
Applied rewrites71.3%
if -1.99999999999999997e77 < z < 4.89999999999999981e181Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6491.4
Applied rewrites91.4%
if 4.89999999999999981e181 < z Initial program 99.6%
Taylor expanded in z around inf
distribute-lft-out--N/A
*-rgt-identityN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-log.f6461.0
Applied rewrites61.0%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (- 1.0 (log t)) z))) (if (<= z -2e+77) t_1 (if (<= z 4.9e+181) (+ (fma (- a 0.5) b y) x) t_1))))
assert(x < y && y < z && z < t && t < a && a < b);
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 <= -2e+77) {
tmp = t_1;
} else if (z <= 4.9e+181) {
tmp = fma((a - 0.5), b, y) + x;
} else {
tmp = t_1;
}
return tmp;
}
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) t_1 = Float64(Float64(1.0 - log(t)) * z) tmp = 0.0 if (z <= -2e+77) tmp = t_1; elseif (z <= 4.9e+181) tmp = Float64(fma(Float64(a - 0.5), b, y) + x); else tmp = t_1; end return tmp end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
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, -2e+77], t$95$1, If[LessEqual[z, 4.9e+181], N[(N[(N[(a - 0.5), $MachinePrecision] * b + y), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := \left(1 - \log t\right) \cdot z\\
\mathbf{if}\;z \leq -2 \cdot 10^{+77}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4.9 \cdot 10^{+181}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, y\right) + x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.99999999999999997e77 or 4.89999999999999981e181 < z Initial program 99.6%
Taylor expanded in x around inf
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-/.f6491.8
Applied rewrites91.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6468.0
Applied rewrites68.0%
if -1.99999999999999997e77 < z < 4.89999999999999981e181Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6491.4
Applied rewrites91.4%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* b (- a 0.5))))
(if (<= t_1 -2.4e+282)
(* b a)
(if (<= t_1 -2e+194) (* -0.5 b) (if (<= t_1 5e+194) (+ y x) (* b a))))))assert(x < y && y < z && z < t && t < a && a < b);
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 <= -2.4e+282) {
tmp = b * a;
} else if (t_1 <= -2e+194) {
tmp = -0.5 * b;
} else if (t_1 <= 5e+194) {
tmp = y + x;
} else {
tmp = b * a;
}
return tmp;
}
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
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 <= (-2.4d+282)) then
tmp = b * a
else if (t_1 <= (-2d+194)) then
tmp = (-0.5d0) * b
else if (t_1 <= 5d+194) then
tmp = y + x
else
tmp = b * a
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b;
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 <= -2.4e+282) {
tmp = b * a;
} else if (t_1 <= -2e+194) {
tmp = -0.5 * b;
} else if (t_1 <= 5e+194) {
tmp = y + x;
} else {
tmp = b * a;
}
return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): t_1 = b * (a - 0.5) tmp = 0 if t_1 <= -2.4e+282: tmp = b * a elif t_1 <= -2e+194: tmp = -0.5 * b elif t_1 <= 5e+194: tmp = y + x else: tmp = b * a return tmp
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) t_1 = Float64(b * Float64(a - 0.5)) tmp = 0.0 if (t_1 <= -2.4e+282) tmp = Float64(b * a); elseif (t_1 <= -2e+194) tmp = Float64(-0.5 * b); elseif (t_1 <= 5e+194) tmp = Float64(y + x); else tmp = Float64(b * a); end return tmp end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = b * (a - 0.5);
tmp = 0.0;
if (t_1 <= -2.4e+282)
tmp = b * a;
elseif (t_1 <= -2e+194)
tmp = -0.5 * b;
elseif (t_1 <= 5e+194)
tmp = y + x;
else
tmp = b * a;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(b * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2.4e+282], N[(b * a), $MachinePrecision], If[LessEqual[t$95$1, -2e+194], N[(-0.5 * b), $MachinePrecision], If[LessEqual[t$95$1, 5e+194], N[(y + x), $MachinePrecision], N[(b * a), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := b \cdot \left(a - 0.5\right)\\
\mathbf{if}\;t\_1 \leq -2.4 \cdot 10^{+282}:\\
\;\;\;\;b \cdot a\\
\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{+194}:\\
\;\;\;\;-0.5 \cdot b\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+194}:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;b \cdot a\\
\end{array}
\end{array}
if (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < -2.40000000000000008e282 or 4.99999999999999989e194 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) Initial program 100.0%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f6477.7
Applied rewrites77.7%
if -2.40000000000000008e282 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < -1.99999999999999989e194Initial program 99.9%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6470.4
Applied rewrites70.4%
Taylor expanded in a around 0
Applied rewrites54.5%
if -1.99999999999999989e194 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < 4.99999999999999989e194Initial 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-+.f6482.6
Applied rewrites82.6%
Taylor expanded in z around 0
Applied rewrites51.4%
Final simplification56.2%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* b (- a 0.5)))) (if (<= t_1 -5e+162) t_1 (if (<= t_1 2e+95) (+ y x) t_1))))
assert(x < y && y < z && z < t && t < a && a < b);
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+162) {
tmp = t_1;
} else if (t_1 <= 2e+95) {
tmp = y + x;
} else {
tmp = t_1;
}
return tmp;
}
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
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 <= (-5d+162)) then
tmp = t_1
else if (t_1 <= 2d+95) then
tmp = y + x
else
tmp = t_1
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b;
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 <= -5e+162) {
tmp = t_1;
} else if (t_1 <= 2e+95) {
tmp = y + x;
} else {
tmp = t_1;
}
return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): t_1 = b * (a - 0.5) tmp = 0 if t_1 <= -5e+162: tmp = t_1 elif t_1 <= 2e+95: tmp = y + x else: tmp = t_1 return tmp
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) t_1 = Float64(b * Float64(a - 0.5)) tmp = 0.0 if (t_1 <= -5e+162) tmp = t_1; elseif (t_1 <= 2e+95) tmp = Float64(y + x); else tmp = t_1; end return tmp end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = b * (a - 0.5);
tmp = 0.0;
if (t_1 <= -5e+162)
tmp = t_1;
elseif (t_1 <= 2e+95)
tmp = y + x;
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
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+162], t$95$1, If[LessEqual[t$95$1, 2e+95], N[(y + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := b \cdot \left(a - 0.5\right)\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+162}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+95}:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < -4.9999999999999997e162 or 2.00000000000000004e95 < (*.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--.f6475.8
Applied rewrites75.8%
if -4.9999999999999997e162 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < 2.00000000000000004e95Initial program 99.7%
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-+.f6489.1
Applied rewrites89.1%
Taylor expanded in z around 0
Applied rewrites55.3%
Final simplification62.7%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* b (- a 0.5)))) (if (<= t_1 -5e+273) (* b a) (if (<= t_1 5e+194) (+ y x) (* b a)))))
assert(x < y && y < z && z < t && t < a && a < b);
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+273) {
tmp = b * a;
} else if (t_1 <= 5e+194) {
tmp = y + x;
} else {
tmp = b * a;
}
return tmp;
}
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
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 <= (-5d+273)) then
tmp = b * a
else if (t_1 <= 5d+194) then
tmp = y + x
else
tmp = b * a
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b;
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 <= -5e+273) {
tmp = b * a;
} else if (t_1 <= 5e+194) {
tmp = y + x;
} else {
tmp = b * a;
}
return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): t_1 = b * (a - 0.5) tmp = 0 if t_1 <= -5e+273: tmp = b * a elif t_1 <= 5e+194: tmp = y + x else: tmp = b * a return tmp
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) t_1 = Float64(b * Float64(a - 0.5)) tmp = 0.0 if (t_1 <= -5e+273) tmp = Float64(b * a); elseif (t_1 <= 5e+194) tmp = Float64(y + x); else tmp = Float64(b * a); end return tmp end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = b * (a - 0.5);
tmp = 0.0;
if (t_1 <= -5e+273)
tmp = b * a;
elseif (t_1 <= 5e+194)
tmp = y + x;
else
tmp = b * a;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
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+273], N[(b * a), $MachinePrecision], If[LessEqual[t$95$1, 5e+194], N[(y + x), $MachinePrecision], N[(b * a), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := b \cdot \left(a - 0.5\right)\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+273}:\\
\;\;\;\;b \cdot a\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+194}:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;b \cdot a\\
\end{array}
\end{array}
if (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < -4.99999999999999961e273 or 4.99999999999999989e194 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) Initial program 100.0%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f6474.6
Applied rewrites74.6%
if -4.99999999999999961e273 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < 4.99999999999999989e194Initial 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-+.f6478.9
Applied rewrites78.9%
Taylor expanded in z around 0
Applied rewrites49.7%
Final simplification54.2%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= (+ y x) 5e+110) (fma (- a 0.5) b x) (+ y x)))
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y + x) <= 5e+110) {
tmp = fma((a - 0.5), b, x);
} else {
tmp = y + x;
}
return tmp;
}
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(y + x) <= 5e+110) tmp = fma(Float64(a - 0.5), b, x); else tmp = Float64(y + x); end return tmp end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(y + x), $MachinePrecision], 5e+110], N[(N[(a - 0.5), $MachinePrecision] * b + x), $MachinePrecision], N[(y + x), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;y + x \leq 5 \cdot 10^{+110}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, x\right)\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if (+.f64 x y) < 4.99999999999999978e110Initial 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
Applied rewrites81.6%
Taylor expanded in z around 0
Applied rewrites52.2%
if 4.99999999999999978e110 < (+.f64 x y) Initial program 99.9%
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-+.f6476.7
Applied rewrites76.7%
Taylor expanded in z around 0
Applied rewrites66.2%
Final simplification55.7%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (+ (fma (- a 0.5) b y) x))
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
return fma((a - 0.5), b, y) + x;
}
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) return Float64(fma(Float64(a - 0.5), b, y) + x) end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(a - 0.5), $MachinePrecision] * b + y), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\mathsf{fma}\left(a - 0.5, b, y\right) + x
\end{array}
Initial program 99.8%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6474.8
Applied rewrites74.8%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (+ y x))
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
return y + x;
}
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
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 = y + x
end function
assert x < y && y < z && z < t && t < a && a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
return y + x;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): return y + x
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) return Float64(y + x) end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp = code(x, y, z, t, a, b)
tmp = y + x;
end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := N[(y + x), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
y + x
\end{array}
Initial 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-+.f6466.1
Applied rewrites66.1%
Taylor expanded in z around 0
Applied rewrites41.7%
Final simplification41.7%
(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 2024276
(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)))