
(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 11 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 (- 0.918938533204673 (fma y (- 0.5 x) x)))
double code(double x, double y) {
return 0.918938533204673 - fma(y, (0.5 - x), x);
}
function code(x, y) return Float64(0.918938533204673 - fma(y, Float64(0.5 - x), x)) end
code[x_, y_] := N[(0.918938533204673 - N[(y * N[(0.5 - x), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.918938533204673 - \mathsf{fma}\left(y, 0.5 - x, x\right)
\end{array}
Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 0.918938533204673 (* y x))))
(if (<= y -1.5e+244)
t_0
(if (<= y -3.4e+207)
(* y -0.5)
(if (<= y -1.0)
t_0
(if (<= y 1.08e-9)
(- 0.918938533204673 x)
(if (<= y 1.8e+105)
(- 0.918938533204673 (* y 0.5))
(if (or (<= y 2.9e+200) (not (<= y 1.46e+271)))
t_0
(* y -0.5)))))))))
double code(double x, double y) {
double t_0 = 0.918938533204673 + (y * x);
double tmp;
if (y <= -1.5e+244) {
tmp = t_0;
} else if (y <= -3.4e+207) {
tmp = y * -0.5;
} else if (y <= -1.0) {
tmp = t_0;
} else if (y <= 1.08e-9) {
tmp = 0.918938533204673 - x;
} else if (y <= 1.8e+105) {
tmp = 0.918938533204673 - (y * 0.5);
} else if ((y <= 2.9e+200) || !(y <= 1.46e+271)) {
tmp = t_0;
} else {
tmp = y * -0.5;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = 0.918938533204673d0 + (y * x)
if (y <= (-1.5d+244)) then
tmp = t_0
else if (y <= (-3.4d+207)) then
tmp = y * (-0.5d0)
else if (y <= (-1.0d0)) then
tmp = t_0
else if (y <= 1.08d-9) then
tmp = 0.918938533204673d0 - x
else if (y <= 1.8d+105) then
tmp = 0.918938533204673d0 - (y * 0.5d0)
else if ((y <= 2.9d+200) .or. (.not. (y <= 1.46d+271))) then
tmp = t_0
else
tmp = y * (-0.5d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 0.918938533204673 + (y * x);
double tmp;
if (y <= -1.5e+244) {
tmp = t_0;
} else if (y <= -3.4e+207) {
tmp = y * -0.5;
} else if (y <= -1.0) {
tmp = t_0;
} else if (y <= 1.08e-9) {
tmp = 0.918938533204673 - x;
} else if (y <= 1.8e+105) {
tmp = 0.918938533204673 - (y * 0.5);
} else if ((y <= 2.9e+200) || !(y <= 1.46e+271)) {
tmp = t_0;
} else {
tmp = y * -0.5;
}
return tmp;
}
def code(x, y): t_0 = 0.918938533204673 + (y * x) tmp = 0 if y <= -1.5e+244: tmp = t_0 elif y <= -3.4e+207: tmp = y * -0.5 elif y <= -1.0: tmp = t_0 elif y <= 1.08e-9: tmp = 0.918938533204673 - x elif y <= 1.8e+105: tmp = 0.918938533204673 - (y * 0.5) elif (y <= 2.9e+200) or not (y <= 1.46e+271): tmp = t_0 else: tmp = y * -0.5 return tmp
function code(x, y) t_0 = Float64(0.918938533204673 + Float64(y * x)) tmp = 0.0 if (y <= -1.5e+244) tmp = t_0; elseif (y <= -3.4e+207) tmp = Float64(y * -0.5); elseif (y <= -1.0) tmp = t_0; elseif (y <= 1.08e-9) tmp = Float64(0.918938533204673 - x); elseif (y <= 1.8e+105) tmp = Float64(0.918938533204673 - Float64(y * 0.5)); elseif ((y <= 2.9e+200) || !(y <= 1.46e+271)) tmp = t_0; else tmp = Float64(y * -0.5); end return tmp end
function tmp_2 = code(x, y) t_0 = 0.918938533204673 + (y * x); tmp = 0.0; if (y <= -1.5e+244) tmp = t_0; elseif (y <= -3.4e+207) tmp = y * -0.5; elseif (y <= -1.0) tmp = t_0; elseif (y <= 1.08e-9) tmp = 0.918938533204673 - x; elseif (y <= 1.8e+105) tmp = 0.918938533204673 - (y * 0.5); elseif ((y <= 2.9e+200) || ~((y <= 1.46e+271))) tmp = t_0; else tmp = y * -0.5; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(0.918938533204673 + N[(y * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.5e+244], t$95$0, If[LessEqual[y, -3.4e+207], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, -1.0], t$95$0, If[LessEqual[y, 1.08e-9], N[(0.918938533204673 - x), $MachinePrecision], If[LessEqual[y, 1.8e+105], N[(0.918938533204673 - N[(y * 0.5), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, 2.9e+200], N[Not[LessEqual[y, 1.46e+271]], $MachinePrecision]], t$95$0, N[(y * -0.5), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.918938533204673 + y \cdot x\\
\mathbf{if}\;y \leq -1.5 \cdot 10^{+244}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -3.4 \cdot 10^{+207}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq -1:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.08 \cdot 10^{-9}:\\
\;\;\;\;0.918938533204673 - x\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{+105}:\\
\;\;\;\;0.918938533204673 - y \cdot 0.5\\
\mathbf{elif}\;y \leq 2.9 \cdot 10^{+200} \lor \neg \left(y \leq 1.46 \cdot 10^{+271}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;y \cdot -0.5\\
\end{array}
\end{array}
if y < -1.4999999999999999e244 or -3.3999999999999998e207 < y < -1 or 1.7999999999999999e105 < y < 2.8999999999999999e200 or 1.46e271 < y Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around inf 96.1%
Taylor expanded in x around inf 67.9%
mul-1-neg67.9%
distribute-rgt-neg-out67.9%
Simplified67.9%
if -1.4999999999999999e244 < y < -3.3999999999999998e207 or 2.8999999999999999e200 < y < 1.46e271Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 77.1%
*-commutative77.1%
Simplified77.1%
Taylor expanded in y around inf 77.1%
*-commutative77.1%
Simplified77.1%
if -1 < y < 1.08e-9Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 98.3%
if 1.08e-9 < y < 1.7999999999999999e105Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in99.9%
metadata-eval99.9%
neg-mul-199.9%
associate--r+99.9%
distribute-lft-out--99.9%
unsub-neg99.9%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 63.8%
*-commutative63.8%
Simplified63.8%
Final simplification83.5%
(FPCore (x y) :precision binary64 (if (or (<= x -65.0) (not (<= x 430000.0))) (+ 0.918938533204673 (- (* y x) x)) (+ 0.918938533204673 (- (* y x) (* y 0.5)))))
double code(double x, double y) {
double tmp;
if ((x <= -65.0) || !(x <= 430000.0)) {
tmp = 0.918938533204673 + ((y * x) - x);
} else {
tmp = 0.918938533204673 + ((y * x) - (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 <= (-65.0d0)) .or. (.not. (x <= 430000.0d0))) then
tmp = 0.918938533204673d0 + ((y * x) - x)
else
tmp = 0.918938533204673d0 + ((y * x) - (y * 0.5d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -65.0) || !(x <= 430000.0)) {
tmp = 0.918938533204673 + ((y * x) - x);
} else {
tmp = 0.918938533204673 + ((y * x) - (y * 0.5));
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -65.0) or not (x <= 430000.0): tmp = 0.918938533204673 + ((y * x) - x) else: tmp = 0.918938533204673 + ((y * x) - (y * 0.5)) return tmp
function code(x, y) tmp = 0.0 if ((x <= -65.0) || !(x <= 430000.0)) tmp = Float64(0.918938533204673 + Float64(Float64(y * x) - x)); else tmp = Float64(0.918938533204673 + Float64(Float64(y * x) - Float64(y * 0.5))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -65.0) || ~((x <= 430000.0))) tmp = 0.918938533204673 + ((y * x) - x); else tmp = 0.918938533204673 + ((y * x) - (y * 0.5)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -65.0], N[Not[LessEqual[x, 430000.0]], $MachinePrecision]], N[(0.918938533204673 + N[(N[(y * x), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 + N[(N[(y * x), $MachinePrecision] - N[(y * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -65 \lor \neg \left(x \leq 430000\right):\\
\;\;\;\;0.918938533204673 + \left(y \cdot x - x\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 + \left(y \cdot x - y \cdot 0.5\right)\\
\end{array}
\end{array}
if x < -65 or 4.3e5 < x Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
fma-undefine100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 99.6%
mul-1-neg46.4%
distribute-rgt-neg-out46.4%
Simplified99.6%
+-commutative99.6%
distribute-rgt-neg-out99.6%
unsub-neg99.6%
Applied egg-rr99.6%
if -65 < x < 4.3e5Initial program 100.0%
Taylor expanded in y around inf 99.5%
Final simplification99.6%
(FPCore (x y) :precision binary64 (if (or (<= x -1.7e-5) (not (<= x 6e-18))) (+ 0.918938533204673 (* x (+ y -1.0))) (- 0.918938533204673 (* y 0.5))))
double code(double x, double y) {
double tmp;
if ((x <= -1.7e-5) || !(x <= 6e-18)) {
tmp = 0.918938533204673 + (x * (y + -1.0));
} 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 <= (-1.7d-5)) .or. (.not. (x <= 6d-18))) then
tmp = 0.918938533204673d0 + (x * (y + (-1.0d0)))
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 <= -1.7e-5) || !(x <= 6e-18)) {
tmp = 0.918938533204673 + (x * (y + -1.0));
} else {
tmp = 0.918938533204673 - (y * 0.5);
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -1.7e-5) or not (x <= 6e-18): tmp = 0.918938533204673 + (x * (y + -1.0)) else: tmp = 0.918938533204673 - (y * 0.5) return tmp
function code(x, y) tmp = 0.0 if ((x <= -1.7e-5) || !(x <= 6e-18)) tmp = Float64(0.918938533204673 + Float64(x * Float64(y + -1.0))); else tmp = Float64(0.918938533204673 - Float64(y * 0.5)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -1.7e-5) || ~((x <= 6e-18))) tmp = 0.918938533204673 + (x * (y + -1.0)); else tmp = 0.918938533204673 - (y * 0.5); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -1.7e-5], N[Not[LessEqual[x, 6e-18]], $MachinePrecision]], N[(0.918938533204673 + N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 - N[(y * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.7 \cdot 10^{-5} \lor \neg \left(x \leq 6 \cdot 10^{-18}\right):\\
\;\;\;\;0.918938533204673 + x \cdot \left(y + -1\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - y \cdot 0.5\\
\end{array}
\end{array}
if x < -1.7e-5 or 5.99999999999999966e-18 < x Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 99.2%
mul-1-neg99.2%
unsub-neg99.2%
Simplified99.2%
if -1.7e-5 < x < 5.99999999999999966e-18Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 99.5%
*-commutative99.5%
Simplified99.5%
Final simplification99.3%
(FPCore (x y) :precision binary64 (if (or (<= x -0.29) (not (<= x 360000.0))) (+ 0.918938533204673 (* x (+ y -1.0))) (+ 0.918938533204673 (* y (- x 0.5)))))
double code(double x, double y) {
double tmp;
if ((x <= -0.29) || !(x <= 360000.0)) {
tmp = 0.918938533204673 + (x * (y + -1.0));
} else {
tmp = 0.918938533204673 + (y * (x - 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.29d0)) .or. (.not. (x <= 360000.0d0))) then
tmp = 0.918938533204673d0 + (x * (y + (-1.0d0)))
else
tmp = 0.918938533204673d0 + (y * (x - 0.5d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -0.29) || !(x <= 360000.0)) {
tmp = 0.918938533204673 + (x * (y + -1.0));
} else {
tmp = 0.918938533204673 + (y * (x - 0.5));
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -0.29) or not (x <= 360000.0): tmp = 0.918938533204673 + (x * (y + -1.0)) else: tmp = 0.918938533204673 + (y * (x - 0.5)) return tmp
function code(x, y) tmp = 0.0 if ((x <= -0.29) || !(x <= 360000.0)) tmp = Float64(0.918938533204673 + Float64(x * Float64(y + -1.0))); else tmp = Float64(0.918938533204673 + Float64(y * Float64(x - 0.5))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -0.29) || ~((x <= 360000.0))) tmp = 0.918938533204673 + (x * (y + -1.0)); else tmp = 0.918938533204673 + (y * (x - 0.5)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -0.29], N[Not[LessEqual[x, 360000.0]], $MachinePrecision]], N[(0.918938533204673 + N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 + N[(y * N[(x - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.29 \lor \neg \left(x \leq 360000\right):\\
\;\;\;\;0.918938533204673 + x \cdot \left(y + -1\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 + y \cdot \left(x - 0.5\right)\\
\end{array}
\end{array}
if x < -0.28999999999999998 or 3.6e5 < x Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 99.6%
mul-1-neg99.6%
unsub-neg99.6%
Simplified99.6%
if -0.28999999999999998 < x < 3.6e5Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around inf 99.5%
Final simplification99.6%
(FPCore (x y) :precision binary64 (if (or (<= x -0.048) (not (<= x 360000.0))) (+ 0.918938533204673 (- (* y x) x)) (+ 0.918938533204673 (* y (- x 0.5)))))
double code(double x, double y) {
double tmp;
if ((x <= -0.048) || !(x <= 360000.0)) {
tmp = 0.918938533204673 + ((y * x) - x);
} else {
tmp = 0.918938533204673 + (y * (x - 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.048d0)) .or. (.not. (x <= 360000.0d0))) then
tmp = 0.918938533204673d0 + ((y * x) - x)
else
tmp = 0.918938533204673d0 + (y * (x - 0.5d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -0.048) || !(x <= 360000.0)) {
tmp = 0.918938533204673 + ((y * x) - x);
} else {
tmp = 0.918938533204673 + (y * (x - 0.5));
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -0.048) or not (x <= 360000.0): tmp = 0.918938533204673 + ((y * x) - x) else: tmp = 0.918938533204673 + (y * (x - 0.5)) return tmp
function code(x, y) tmp = 0.0 if ((x <= -0.048) || !(x <= 360000.0)) tmp = Float64(0.918938533204673 + Float64(Float64(y * x) - x)); else tmp = Float64(0.918938533204673 + Float64(y * Float64(x - 0.5))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -0.048) || ~((x <= 360000.0))) tmp = 0.918938533204673 + ((y * x) - x); else tmp = 0.918938533204673 + (y * (x - 0.5)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -0.048], N[Not[LessEqual[x, 360000.0]], $MachinePrecision]], N[(0.918938533204673 + N[(N[(y * x), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 + N[(y * N[(x - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.048 \lor \neg \left(x \leq 360000\right):\\
\;\;\;\;0.918938533204673 + \left(y \cdot x - x\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 + y \cdot \left(x - 0.5\right)\\
\end{array}
\end{array}
if x < -0.048000000000000001 or 3.6e5 < x Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
fma-undefine100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 99.6%
mul-1-neg46.4%
distribute-rgt-neg-out46.4%
Simplified99.6%
+-commutative99.6%
distribute-rgt-neg-out99.6%
unsub-neg99.6%
Applied egg-rr99.6%
if -0.048000000000000001 < x < 3.6e5Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around inf 99.5%
Final simplification99.6%
(FPCore (x y) :precision binary64 (if (or (<= y -41000.0) (not (<= y 7.5e-10))) (- 0.918938533204673 (* y 0.5)) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -41000.0) || !(y <= 7.5e-10)) {
tmp = 0.918938533204673 - (y * 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 <= (-41000.0d0)) .or. (.not. (y <= 7.5d-10))) then
tmp = 0.918938533204673d0 - (y * 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 <= -41000.0) || !(y <= 7.5e-10)) {
tmp = 0.918938533204673 - (y * 0.5);
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -41000.0) or not (y <= 7.5e-10): tmp = 0.918938533204673 - (y * 0.5) else: tmp = 0.918938533204673 - x return tmp
function code(x, y) tmp = 0.0 if ((y <= -41000.0) || !(y <= 7.5e-10)) tmp = Float64(0.918938533204673 - Float64(y * 0.5)); else tmp = Float64(0.918938533204673 - x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -41000.0) || ~((y <= 7.5e-10))) tmp = 0.918938533204673 - (y * 0.5); else tmp = 0.918938533204673 - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -41000.0], N[Not[LessEqual[y, 7.5e-10]], $MachinePrecision]], N[(0.918938533204673 - N[(y * 0.5), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -41000 \lor \neg \left(y \leq 7.5 \cdot 10^{-10}\right):\\
\;\;\;\;0.918938533204673 - y \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\
\end{array}
\end{array}
if y < -41000 or 7.49999999999999995e-10 < y Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 48.4%
*-commutative48.4%
Simplified48.4%
if -41000 < y < 7.49999999999999995e-10Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 95.7%
Final simplification72.8%
(FPCore (x y) :precision binary64 (if (or (<= y -0.00029) (not (<= y 0.037))) (* y -0.5) 0.918938533204673))
double code(double x, double y) {
double tmp;
if ((y <= -0.00029) || !(y <= 0.037)) {
tmp = y * -0.5;
} 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 ((y <= (-0.00029d0)) .or. (.not. (y <= 0.037d0))) then
tmp = y * (-0.5d0)
else
tmp = 0.918938533204673d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -0.00029) || !(y <= 0.037)) {
tmp = y * -0.5;
} else {
tmp = 0.918938533204673;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -0.00029) or not (y <= 0.037): tmp = y * -0.5 else: tmp = 0.918938533204673 return tmp
function code(x, y) tmp = 0.0 if ((y <= -0.00029) || !(y <= 0.037)) tmp = Float64(y * -0.5); else tmp = 0.918938533204673; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -0.00029) || ~((y <= 0.037))) tmp = y * -0.5; else tmp = 0.918938533204673; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -0.00029], N[Not[LessEqual[y, 0.037]], $MachinePrecision]], N[(y * -0.5), $MachinePrecision], 0.918938533204673]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.00029 \lor \neg \left(y \leq 0.037\right):\\
\;\;\;\;y \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673\\
\end{array}
\end{array}
if y < -2.9e-4 or 0.0369999999999999982 < y Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 45.8%
*-commutative45.8%
Simplified45.8%
Taylor expanded in y around inf 43.5%
*-commutative43.5%
Simplified43.5%
if -2.9e-4 < y < 0.0369999999999999982Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 43.9%
*-commutative43.9%
Simplified43.9%
Taylor expanded in y around 0 43.0%
Final simplification43.3%
(FPCore (x y) :precision binary64 (if (or (<= y -116000.0) (not (<= y 1.85))) (* y -0.5) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -116000.0) || !(y <= 1.85)) {
tmp = y * -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 <= (-116000.0d0)) .or. (.not. (y <= 1.85d0))) then
tmp = y * (-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 <= -116000.0) || !(y <= 1.85)) {
tmp = y * -0.5;
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -116000.0) or not (y <= 1.85): tmp = y * -0.5 else: tmp = 0.918938533204673 - x return tmp
function code(x, y) tmp = 0.0 if ((y <= -116000.0) || !(y <= 1.85)) tmp = Float64(y * -0.5); else tmp = Float64(0.918938533204673 - x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -116000.0) || ~((y <= 1.85))) tmp = y * -0.5; else tmp = 0.918938533204673 - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -116000.0], N[Not[LessEqual[y, 1.85]], $MachinePrecision]], N[(y * -0.5), $MachinePrecision], N[(0.918938533204673 - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -116000 \lor \neg \left(y \leq 1.85\right):\\
\;\;\;\;y \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\
\end{array}
\end{array}
if y < -116000 or 1.8500000000000001 < y Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 47.9%
*-commutative47.9%
Simplified47.9%
Taylor expanded in y around inf 45.5%
*-commutative45.5%
Simplified45.5%
if -116000 < y < 1.8500000000000001Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 94.6%
Final simplification71.4%
(FPCore (x y) :precision binary64 (- 0.918938533204673 (- x (* y (- x 0.5)))))
double code(double x, double y) {
return 0.918938533204673 - (x - (y * (x - 0.5)));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 0.918938533204673d0 - (x - (y * (x - 0.5d0)))
end function
public static double code(double x, double y) {
return 0.918938533204673 - (x - (y * (x - 0.5)));
}
def code(x, y): return 0.918938533204673 - (x - (y * (x - 0.5)))
function code(x, y) return Float64(0.918938533204673 - Float64(x - Float64(y * Float64(x - 0.5)))) end
function tmp = code(x, y) tmp = 0.918938533204673 - (x - (y * (x - 0.5))); end
code[x_, y_] := N[(0.918938533204673 - N[(x - N[(y * N[(x - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.918938533204673 - \left(x - y \cdot \left(x - 0.5\right)\right)
\end{array}
Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
fma-undefine100.0%
Applied egg-rr100.0%
Final simplification100.0%
(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%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 44.9%
*-commutative44.9%
Simplified44.9%
Taylor expanded in y around 0 23.0%
Final simplification23.0%
herbie shell --seed 2024034
(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))