
(FPCore (x y) :precision binary64 (+ (- (* x (- y 1.0)) (* y 0.5)) 0.918938533204673))
double code(double x, double y) {
return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x * (y - 1.0d0)) - (y * 0.5d0)) + 0.918938533204673d0
end function
public static double code(double x, double y) {
return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673;
}
def code(x, y): return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673
function code(x, y) return Float64(Float64(Float64(x * Float64(y - 1.0)) - Float64(y * 0.5)) + 0.918938533204673) end
function tmp = code(x, y) tmp = ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673; end
code[x_, y_] := N[(N[(N[(x * N[(y - 1.0), $MachinePrecision]), $MachinePrecision] - N[(y * 0.5), $MachinePrecision]), $MachinePrecision] + 0.918938533204673), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (+ (- (* x (- y 1.0)) (* y 0.5)) 0.918938533204673))
double code(double x, double y) {
return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x * (y - 1.0d0)) - (y * 0.5d0)) + 0.918938533204673d0
end function
public static double code(double x, double y) {
return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673;
}
def code(x, y): return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673
function code(x, y) return Float64(Float64(Float64(x * Float64(y - 1.0)) - Float64(y * 0.5)) + 0.918938533204673) end
function tmp = code(x, y) tmp = ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673; end
code[x_, y_] := N[(N[(N[(x * N[(y - 1.0), $MachinePrecision]), $MachinePrecision] - N[(y * 0.5), $MachinePrecision]), $MachinePrecision] + 0.918938533204673), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673
\end{array}
(FPCore (x y) :precision binary64 (- (+ (* y (+ x -0.5)) 0.918938533204673) x))
double code(double x, double y) {
return ((y * (x + -0.5)) + 0.918938533204673) - x;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((y * (x + (-0.5d0))) + 0.918938533204673d0) - x
end function
public static double code(double x, double y) {
return ((y * (x + -0.5)) + 0.918938533204673) - x;
}
def code(x, y): return ((y * (x + -0.5)) + 0.918938533204673) - x
function code(x, y) return Float64(Float64(Float64(y * Float64(x + -0.5)) + 0.918938533204673) - x) end
function tmp = code(x, y) tmp = ((y * (x + -0.5)) + 0.918938533204673) - x; end
code[x_, y_] := N[(N[(N[(y * N[(x + -0.5), $MachinePrecision]), $MachinePrecision] + 0.918938533204673), $MachinePrecision] - x), $MachinePrecision]
\begin{array}{l}
\\
\left(y \cdot \left(x + -0.5\right) + 0.918938533204673\right) - x
\end{array}
Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
unsub-neg100.0%
associate--l-100.0%
+-commutative100.0%
associate--r+100.0%
associate--r-100.0%
distribute-lft-out--100.0%
sub-neg100.0%
+-commutative100.0%
fma-def100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
fma-udef100.0%
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(if (<= y -1.0)
(* y x)
(if (<= y -1.8e-88)
(- x)
(if (<= y -8.4e-193)
0.918938533204673
(if (<= y -4.2e-267)
(- x)
(if (<= y 9.6e-237)
0.918938533204673
(if (<= y 6.6e-121)
(- x)
(if (<= y 1.0) 0.918938533204673 (* y x)))))))))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = y * x;
} else if (y <= -1.8e-88) {
tmp = -x;
} else if (y <= -8.4e-193) {
tmp = 0.918938533204673;
} else if (y <= -4.2e-267) {
tmp = -x;
} else if (y <= 9.6e-237) {
tmp = 0.918938533204673;
} else if (y <= 6.6e-121) {
tmp = -x;
} else if (y <= 1.0) {
tmp = 0.918938533204673;
} else {
tmp = y * x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-1.0d0)) then
tmp = y * x
else if (y <= (-1.8d-88)) then
tmp = -x
else if (y <= (-8.4d-193)) then
tmp = 0.918938533204673d0
else if (y <= (-4.2d-267)) then
tmp = -x
else if (y <= 9.6d-237) then
tmp = 0.918938533204673d0
else if (y <= 6.6d-121) then
tmp = -x
else if (y <= 1.0d0) then
tmp = 0.918938533204673d0
else
tmp = y * x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = y * x;
} else if (y <= -1.8e-88) {
tmp = -x;
} else if (y <= -8.4e-193) {
tmp = 0.918938533204673;
} else if (y <= -4.2e-267) {
tmp = -x;
} else if (y <= 9.6e-237) {
tmp = 0.918938533204673;
} else if (y <= 6.6e-121) {
tmp = -x;
} else if (y <= 1.0) {
tmp = 0.918938533204673;
} else {
tmp = y * x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = y * x elif y <= -1.8e-88: tmp = -x elif y <= -8.4e-193: tmp = 0.918938533204673 elif y <= -4.2e-267: tmp = -x elif y <= 9.6e-237: tmp = 0.918938533204673 elif y <= 6.6e-121: tmp = -x elif y <= 1.0: tmp = 0.918938533204673 else: tmp = y * x return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = Float64(y * x); elseif (y <= -1.8e-88) tmp = Float64(-x); elseif (y <= -8.4e-193) tmp = 0.918938533204673; elseif (y <= -4.2e-267) tmp = Float64(-x); elseif (y <= 9.6e-237) tmp = 0.918938533204673; elseif (y <= 6.6e-121) tmp = Float64(-x); elseif (y <= 1.0) tmp = 0.918938533204673; else tmp = Float64(y * x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.0) tmp = y * x; elseif (y <= -1.8e-88) tmp = -x; elseif (y <= -8.4e-193) tmp = 0.918938533204673; elseif (y <= -4.2e-267) tmp = -x; elseif (y <= 9.6e-237) tmp = 0.918938533204673; elseif (y <= 6.6e-121) tmp = -x; elseif (y <= 1.0) tmp = 0.918938533204673; else tmp = y * x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], N[(y * x), $MachinePrecision], If[LessEqual[y, -1.8e-88], (-x), If[LessEqual[y, -8.4e-193], 0.918938533204673, If[LessEqual[y, -4.2e-267], (-x), If[LessEqual[y, 9.6e-237], 0.918938533204673, If[LessEqual[y, 6.6e-121], (-x), If[LessEqual[y, 1.0], 0.918938533204673, N[(y * x), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq -1.8 \cdot 10^{-88}:\\
\;\;\;\;-x\\
\mathbf{elif}\;y \leq -8.4 \cdot 10^{-193}:\\
\;\;\;\;0.918938533204673\\
\mathbf{elif}\;y \leq -4.2 \cdot 10^{-267}:\\
\;\;\;\;-x\\
\mathbf{elif}\;y \leq 9.6 \cdot 10^{-237}:\\
\;\;\;\;0.918938533204673\\
\mathbf{elif}\;y \leq 6.6 \cdot 10^{-121}:\\
\;\;\;\;-x\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;0.918938533204673\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}
\end{array}
if y < -1 or 1 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
unsub-neg100.0%
associate--l-100.0%
+-commutative100.0%
associate--r+100.0%
associate--r-100.0%
distribute-lft-out--100.0%
sub-neg100.0%
+-commutative100.0%
fma-def100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
fma-udef100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 56.2%
*-commutative56.2%
Simplified56.2%
Taylor expanded in y around inf 56.1%
Taylor expanded in y around inf 55.2%
if -1 < y < -1.8e-88 or -8.3999999999999997e-193 < y < -4.2000000000000003e-267 or 9.5999999999999999e-237 < y < 6.6000000000000002e-121Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
unsub-neg100.0%
associate--l-100.0%
+-commutative100.0%
associate--r+100.0%
associate--r-100.0%
distribute-lft-out--100.0%
sub-neg100.0%
+-commutative100.0%
fma-def100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
fma-udef100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 98.1%
*-commutative98.1%
Simplified98.1%
Taylor expanded in y around inf 69.9%
Taylor expanded in y around 0 67.3%
neg-mul-167.3%
Simplified67.3%
if -1.8e-88 < y < -8.3999999999999997e-193 or -4.2000000000000003e-267 < y < 9.5999999999999999e-237 or 6.6000000000000002e-121 < y < 1Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 73.7%
Taylor expanded in y around 0 71.6%
Final simplification62.1%
(FPCore (x y) :precision binary64 (if (or (<= x -5.8e-8) (not (<= x 7900.0))) (- (+ 0.918938533204673 (* y x)) x) (+ (* y x) (- 0.918938533204673 (* y 0.5)))))
double code(double x, double y) {
double tmp;
if ((x <= -5.8e-8) || !(x <= 7900.0)) {
tmp = (0.918938533204673 + (y * x)) - x;
} else {
tmp = (y * x) + (0.918938533204673 - (y * 0.5));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((x <= (-5.8d-8)) .or. (.not. (x <= 7900.0d0))) then
tmp = (0.918938533204673d0 + (y * x)) - x
else
tmp = (y * x) + (0.918938533204673d0 - (y * 0.5d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -5.8e-8) || !(x <= 7900.0)) {
tmp = (0.918938533204673 + (y * x)) - x;
} else {
tmp = (y * x) + (0.918938533204673 - (y * 0.5));
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -5.8e-8) or not (x <= 7900.0): tmp = (0.918938533204673 + (y * x)) - x else: tmp = (y * x) + (0.918938533204673 - (y * 0.5)) return tmp
function code(x, y) tmp = 0.0 if ((x <= -5.8e-8) || !(x <= 7900.0)) tmp = Float64(Float64(0.918938533204673 + Float64(y * x)) - x); else tmp = Float64(Float64(y * x) + Float64(0.918938533204673 - Float64(y * 0.5))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -5.8e-8) || ~((x <= 7900.0))) tmp = (0.918938533204673 + (y * x)) - x; else tmp = (y * x) + (0.918938533204673 - (y * 0.5)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -5.8e-8], N[Not[LessEqual[x, 7900.0]], $MachinePrecision]], N[(N[(0.918938533204673 + N[(y * x), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision], N[(N[(y * x), $MachinePrecision] + N[(0.918938533204673 - N[(y * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.8 \cdot 10^{-8} \lor \neg \left(x \leq 7900\right):\\
\;\;\;\;\left(0.918938533204673 + y \cdot x\right) - x\\
\mathbf{else}:\\
\;\;\;\;y \cdot x + \left(0.918938533204673 - y \cdot 0.5\right)\\
\end{array}
\end{array}
if x < -5.8000000000000003e-8 or 7900 < x Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
unsub-neg100.0%
associate--l-100.0%
+-commutative100.0%
associate--r+100.0%
associate--r-100.0%
distribute-lft-out--100.0%
sub-neg100.0%
+-commutative100.0%
fma-def100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
fma-udef100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 100.0%
*-commutative100.0%
Simplified100.0%
if -5.8000000000000003e-8 < x < 7900Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
Final simplification100.0%
(FPCore (x y) :precision binary64 (if (or (<= x -4.1e-8) (not (<= x 3.05e-5))) (- (+ 0.918938533204673 (* y x)) x) (- 0.918938533204673 (* y 0.5))))
double code(double x, double y) {
double tmp;
if ((x <= -4.1e-8) || !(x <= 3.05e-5)) {
tmp = (0.918938533204673 + (y * x)) - x;
} else {
tmp = 0.918938533204673 - (y * 0.5);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((x <= (-4.1d-8)) .or. (.not. (x <= 3.05d-5))) then
tmp = (0.918938533204673d0 + (y * x)) - x
else
tmp = 0.918938533204673d0 - (y * 0.5d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -4.1e-8) || !(x <= 3.05e-5)) {
tmp = (0.918938533204673 + (y * x)) - x;
} else {
tmp = 0.918938533204673 - (y * 0.5);
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -4.1e-8) or not (x <= 3.05e-5): tmp = (0.918938533204673 + (y * x)) - x else: tmp = 0.918938533204673 - (y * 0.5) return tmp
function code(x, y) tmp = 0.0 if ((x <= -4.1e-8) || !(x <= 3.05e-5)) tmp = Float64(Float64(0.918938533204673 + Float64(y * x)) - x); else tmp = Float64(0.918938533204673 - Float64(y * 0.5)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -4.1e-8) || ~((x <= 3.05e-5))) tmp = (0.918938533204673 + (y * x)) - x; else tmp = 0.918938533204673 - (y * 0.5); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -4.1e-8], N[Not[LessEqual[x, 3.05e-5]], $MachinePrecision]], N[(N[(0.918938533204673 + N[(y * x), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision], N[(0.918938533204673 - N[(y * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.1 \cdot 10^{-8} \lor \neg \left(x \leq 3.05 \cdot 10^{-5}\right):\\
\;\;\;\;\left(0.918938533204673 + y \cdot x\right) - x\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - y \cdot 0.5\\
\end{array}
\end{array}
if x < -4.10000000000000032e-8 or 3.04999999999999994e-5 < x Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
unsub-neg100.0%
associate--l-100.0%
+-commutative100.0%
associate--r+100.0%
associate--r-100.0%
distribute-lft-out--100.0%
sub-neg100.0%
+-commutative100.0%
fma-def100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
fma-udef100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 100.0%
*-commutative100.0%
Simplified100.0%
if -4.10000000000000032e-8 < x < 3.04999999999999994e-5Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 99.2%
Final simplification99.6%
(FPCore (x y) :precision binary64 (if (or (<= y -1.4) (not (<= y 1.15))) (* y (- x 0.5)) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -1.4) || !(y <= 1.15)) {
tmp = y * (x - 0.5);
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-1.4d0)) .or. (.not. (y <= 1.15d0))) then
tmp = y * (x - 0.5d0)
else
tmp = 0.918938533204673d0 - x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -1.4) || !(y <= 1.15)) {
tmp = y * (x - 0.5);
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.4) or not (y <= 1.15): tmp = y * (x - 0.5) else: tmp = 0.918938533204673 - x return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.4) || !(y <= 1.15)) tmp = Float64(y * Float64(x - 0.5)); else tmp = Float64(0.918938533204673 - x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1.4) || ~((y <= 1.15))) tmp = y * (x - 0.5); else tmp = 0.918938533204673 - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.4], N[Not[LessEqual[y, 1.15]], $MachinePrecision]], N[(y * N[(x - 0.5), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.4 \lor \neg \left(y \leq 1.15\right):\\
\;\;\;\;y \cdot \left(x - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\
\end{array}
\end{array}
if y < -1.3999999999999999 or 1.1499999999999999 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 97.9%
if -1.3999999999999999 < y < 1.1499999999999999Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 96.3%
neg-mul-196.3%
unsub-neg96.3%
Simplified96.3%
Final simplification97.1%
(FPCore (x y) :precision binary64 (if (or (<= x -0.74) (not (<= x 0.6))) (- (* y x) x) (- 0.918938533204673 (* y 0.5))))
double code(double x, double y) {
double tmp;
if ((x <= -0.74) || !(x <= 0.6)) {
tmp = (y * x) - x;
} else {
tmp = 0.918938533204673 - (y * 0.5);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((x <= (-0.74d0)) .or. (.not. (x <= 0.6d0))) then
tmp = (y * x) - x
else
tmp = 0.918938533204673d0 - (y * 0.5d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -0.74) || !(x <= 0.6)) {
tmp = (y * x) - x;
} else {
tmp = 0.918938533204673 - (y * 0.5);
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -0.74) or not (x <= 0.6): tmp = (y * x) - x else: tmp = 0.918938533204673 - (y * 0.5) return tmp
function code(x, y) tmp = 0.0 if ((x <= -0.74) || !(x <= 0.6)) tmp = Float64(Float64(y * x) - x); else tmp = Float64(0.918938533204673 - Float64(y * 0.5)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -0.74) || ~((x <= 0.6))) tmp = (y * x) - x; else tmp = 0.918938533204673 - (y * 0.5); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -0.74], N[Not[LessEqual[x, 0.6]], $MachinePrecision]], N[(N[(y * x), $MachinePrecision] - x), $MachinePrecision], N[(0.918938533204673 - N[(y * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.74 \lor \neg \left(x \leq 0.6\right):\\
\;\;\;\;y \cdot x - x\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - y \cdot 0.5\\
\end{array}
\end{array}
if x < -0.73999999999999999 or 0.599999999999999978 < x Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
unsub-neg100.0%
associate--l-100.0%
+-commutative100.0%
associate--r+100.0%
associate--r-100.0%
distribute-lft-out--100.0%
sub-neg100.0%
+-commutative100.0%
fma-def100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
fma-udef100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in y around inf 99.3%
if -0.73999999999999999 < x < 0.599999999999999978Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 97.7%
Final simplification98.5%
(FPCore (x y) :precision binary64 (if (or (<= y -76.0) (not (<= y 1.0))) (* y x) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -76.0) || !(y <= 1.0)) {
tmp = y * x;
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-76.0d0)) .or. (.not. (y <= 1.0d0))) then
tmp = y * x
else
tmp = 0.918938533204673d0 - x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -76.0) || !(y <= 1.0)) {
tmp = y * x;
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -76.0) or not (y <= 1.0): tmp = y * x else: tmp = 0.918938533204673 - x return tmp
function code(x, y) tmp = 0.0 if ((y <= -76.0) || !(y <= 1.0)) tmp = Float64(y * x); else tmp = Float64(0.918938533204673 - x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -76.0) || ~((y <= 1.0))) tmp = y * x; else tmp = 0.918938533204673 - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -76.0], N[Not[LessEqual[y, 1.0]], $MachinePrecision]], N[(y * x), $MachinePrecision], N[(0.918938533204673 - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -76 \lor \neg \left(y \leq 1\right):\\
\;\;\;\;y \cdot x\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\
\end{array}
\end{array}
if y < -76 or 1 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
unsub-neg100.0%
associate--l-100.0%
+-commutative100.0%
associate--r+100.0%
associate--r-100.0%
distribute-lft-out--100.0%
sub-neg100.0%
+-commutative100.0%
fma-def100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
fma-udef100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 56.2%
*-commutative56.2%
Simplified56.2%
Taylor expanded in y around inf 56.1%
Taylor expanded in y around inf 55.2%
if -76 < y < 1Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 96.3%
neg-mul-196.3%
unsub-neg96.3%
Simplified96.3%
Final simplification75.1%
(FPCore (x y) :precision binary64 (if (or (<= x -0.92) (not (<= x 7.2e-30))) (- x) 0.918938533204673))
double code(double x, double y) {
double tmp;
if ((x <= -0.92) || !(x <= 7.2e-30)) {
tmp = -x;
} else {
tmp = 0.918938533204673;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((x <= (-0.92d0)) .or. (.not. (x <= 7.2d-30))) then
tmp = -x
else
tmp = 0.918938533204673d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -0.92) || !(x <= 7.2e-30)) {
tmp = -x;
} else {
tmp = 0.918938533204673;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -0.92) or not (x <= 7.2e-30): tmp = -x else: tmp = 0.918938533204673 return tmp
function code(x, y) tmp = 0.0 if ((x <= -0.92) || !(x <= 7.2e-30)) tmp = Float64(-x); else tmp = 0.918938533204673; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -0.92) || ~((x <= 7.2e-30))) tmp = -x; else tmp = 0.918938533204673; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -0.92], N[Not[LessEqual[x, 7.2e-30]], $MachinePrecision]], (-x), 0.918938533204673]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.92 \lor \neg \left(x \leq 7.2 \cdot 10^{-30}\right):\\
\;\;\;\;-x\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673\\
\end{array}
\end{array}
if x < -0.92000000000000004 or 7.2000000000000006e-30 < x Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
unsub-neg100.0%
associate--l-100.0%
+-commutative100.0%
associate--r+100.0%
associate--r-100.0%
distribute-lft-out--100.0%
sub-neg100.0%
+-commutative100.0%
fma-def100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
fma-udef100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 97.7%
*-commutative97.7%
Simplified97.7%
Taylor expanded in y around inf 97.0%
Taylor expanded in y around 0 43.4%
neg-mul-143.4%
Simplified43.4%
if -0.92000000000000004 < x < 7.2000000000000006e-30Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 98.5%
Taylor expanded in y around 0 51.6%
Final simplification47.3%
(FPCore (x y) :precision binary64 0.918938533204673)
double code(double x, double y) {
return 0.918938533204673;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 0.918938533204673d0
end function
public static double code(double x, double y) {
return 0.918938533204673;
}
def code(x, y): return 0.918938533204673
function code(x, y) return 0.918938533204673 end
function tmp = code(x, y) tmp = 0.918938533204673; end
code[x_, y_] := 0.918938533204673
\begin{array}{l}
\\
0.918938533204673
\end{array}
Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 77.1%
Taylor expanded in y around 0 26.0%
Final simplification26.0%
herbie shell --seed 2023322
(FPCore (x y)
:name "Numeric.SpecFunctions:logGamma from math-functions-0.1.5.2, A"
:precision binary64
(+ (- (* x (- y 1.0)) (* y 0.5)) 0.918938533204673))