
(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 (+ (- (* 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}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(if (<= y -7.5e+34)
(* y -0.5)
(if (<= y -0.27)
(* x y)
(if (<= y 8e-268)
0.918938533204673
(if (<= y 1.35e-178)
(- x)
(if (<= y 1.7)
0.918938533204673
(if (<= y 8.4e+204) (* x y) (* y -0.5))))))))
double code(double x, double y) {
double tmp;
if (y <= -7.5e+34) {
tmp = y * -0.5;
} else if (y <= -0.27) {
tmp = x * y;
} else if (y <= 8e-268) {
tmp = 0.918938533204673;
} else if (y <= 1.35e-178) {
tmp = -x;
} else if (y <= 1.7) {
tmp = 0.918938533204673;
} else if (y <= 8.4e+204) {
tmp = x * y;
} 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) :: tmp
if (y <= (-7.5d+34)) then
tmp = y * (-0.5d0)
else if (y <= (-0.27d0)) then
tmp = x * y
else if (y <= 8d-268) then
tmp = 0.918938533204673d0
else if (y <= 1.35d-178) then
tmp = -x
else if (y <= 1.7d0) then
tmp = 0.918938533204673d0
else if (y <= 8.4d+204) then
tmp = x * y
else
tmp = y * (-0.5d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -7.5e+34) {
tmp = y * -0.5;
} else if (y <= -0.27) {
tmp = x * y;
} else if (y <= 8e-268) {
tmp = 0.918938533204673;
} else if (y <= 1.35e-178) {
tmp = -x;
} else if (y <= 1.7) {
tmp = 0.918938533204673;
} else if (y <= 8.4e+204) {
tmp = x * y;
} else {
tmp = y * -0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -7.5e+34: tmp = y * -0.5 elif y <= -0.27: tmp = x * y elif y <= 8e-268: tmp = 0.918938533204673 elif y <= 1.35e-178: tmp = -x elif y <= 1.7: tmp = 0.918938533204673 elif y <= 8.4e+204: tmp = x * y else: tmp = y * -0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= -7.5e+34) tmp = Float64(y * -0.5); elseif (y <= -0.27) tmp = Float64(x * y); elseif (y <= 8e-268) tmp = 0.918938533204673; elseif (y <= 1.35e-178) tmp = Float64(-x); elseif (y <= 1.7) tmp = 0.918938533204673; elseif (y <= 8.4e+204) tmp = Float64(x * y); else tmp = Float64(y * -0.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -7.5e+34) tmp = y * -0.5; elseif (y <= -0.27) tmp = x * y; elseif (y <= 8e-268) tmp = 0.918938533204673; elseif (y <= 1.35e-178) tmp = -x; elseif (y <= 1.7) tmp = 0.918938533204673; elseif (y <= 8.4e+204) tmp = x * y; else tmp = y * -0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -7.5e+34], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, -0.27], N[(x * y), $MachinePrecision], If[LessEqual[y, 8e-268], 0.918938533204673, If[LessEqual[y, 1.35e-178], (-x), If[LessEqual[y, 1.7], 0.918938533204673, If[LessEqual[y, 8.4e+204], N[(x * y), $MachinePrecision], N[(y * -0.5), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.5 \cdot 10^{+34}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq -0.27:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;y \leq 8 \cdot 10^{-268}:\\
\;\;\;\;0.918938533204673\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{-178}:\\
\;\;\;\;-x\\
\mathbf{elif}\;y \leq 1.7:\\
\;\;\;\;0.918938533204673\\
\mathbf{elif}\;y \leq 8.4 \cdot 10^{+204}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;y \cdot -0.5\\
\end{array}
\end{array}
if y < -7.49999999999999976e34 or 8.4000000000000002e204 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
Taylor expanded in x around 0 64.9%
if -7.49999999999999976e34 < y < -0.27000000000000002 or 1.69999999999999996 < y < 8.4000000000000002e204Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 94.7%
Taylor expanded in x around inf 66.9%
if -0.27000000000000002 < y < 7.99999999999999966e-268 or 1.35000000000000004e-178 < y < 1.69999999999999996Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 96.9%
neg-mul-196.9%
sub-neg96.9%
Simplified96.9%
Taylor expanded in x around 0 55.0%
if 7.99999999999999966e-268 < y < 1.35000000000000004e-178Initial program 100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate-+r+100.0%
unsub-neg100.0%
associate-+l-100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
distribute-lft-out100.0%
fma-neg100.0%
+-commutative100.0%
metadata-eval100.0%
neg-sub0100.0%
associate-+l-100.0%
neg-sub0100.0%
+-commutative100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in x around -inf 86.5%
Taylor expanded in y around 0 86.5%
neg-mul-186.5%
Simplified86.5%
Final simplification63.3%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* x (+ y -1.0))))
(if (<= y -6.5e+33)
(* y -0.5)
(if (<= y -0.0315)
t_0
(if (<= y 0.000175)
(- 0.918938533204673 x)
(if (<= y 3.2e+204) t_0 (* y -0.5)))))))
double code(double x, double y) {
double t_0 = x * (y + -1.0);
double tmp;
if (y <= -6.5e+33) {
tmp = y * -0.5;
} else if (y <= -0.0315) {
tmp = t_0;
} else if (y <= 0.000175) {
tmp = 0.918938533204673 - x;
} else if (y <= 3.2e+204) {
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 = x * (y + (-1.0d0))
if (y <= (-6.5d+33)) then
tmp = y * (-0.5d0)
else if (y <= (-0.0315d0)) then
tmp = t_0
else if (y <= 0.000175d0) then
tmp = 0.918938533204673d0 - x
else if (y <= 3.2d+204) 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 = x * (y + -1.0);
double tmp;
if (y <= -6.5e+33) {
tmp = y * -0.5;
} else if (y <= -0.0315) {
tmp = t_0;
} else if (y <= 0.000175) {
tmp = 0.918938533204673 - x;
} else if (y <= 3.2e+204) {
tmp = t_0;
} else {
tmp = y * -0.5;
}
return tmp;
}
def code(x, y): t_0 = x * (y + -1.0) tmp = 0 if y <= -6.5e+33: tmp = y * -0.5 elif y <= -0.0315: tmp = t_0 elif y <= 0.000175: tmp = 0.918938533204673 - x elif y <= 3.2e+204: tmp = t_0 else: tmp = y * -0.5 return tmp
function code(x, y) t_0 = Float64(x * Float64(y + -1.0)) tmp = 0.0 if (y <= -6.5e+33) tmp = Float64(y * -0.5); elseif (y <= -0.0315) tmp = t_0; elseif (y <= 0.000175) tmp = Float64(0.918938533204673 - x); elseif (y <= 3.2e+204) tmp = t_0; else tmp = Float64(y * -0.5); end return tmp end
function tmp_2 = code(x, y) t_0 = x * (y + -1.0); tmp = 0.0; if (y <= -6.5e+33) tmp = y * -0.5; elseif (y <= -0.0315) tmp = t_0; elseif (y <= 0.000175) tmp = 0.918938533204673 - x; elseif (y <= 3.2e+204) tmp = t_0; else tmp = y * -0.5; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -6.5e+33], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, -0.0315], t$95$0, If[LessEqual[y, 0.000175], N[(0.918938533204673 - x), $MachinePrecision], If[LessEqual[y, 3.2e+204], t$95$0, N[(y * -0.5), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(y + -1\right)\\
\mathbf{if}\;y \leq -6.5 \cdot 10^{+33}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq -0.0315:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 0.000175:\\
\;\;\;\;0.918938533204673 - x\\
\mathbf{elif}\;y \leq 3.2 \cdot 10^{+204}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;y \cdot -0.5\\
\end{array}
\end{array}
if y < -6.49999999999999993e33 or 3.2e204 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
Taylor expanded in x around 0 64.9%
if -6.49999999999999993e33 < y < -0.0315 or 1.74999999999999998e-4 < y < 3.2e204Initial program 100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate-+r+100.0%
unsub-neg100.0%
associate-+l-100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
distribute-lft-out99.9%
fma-neg100.0%
+-commutative100.0%
metadata-eval100.0%
neg-sub0100.0%
associate-+l-100.0%
neg-sub0100.0%
+-commutative100.0%
unsub-neg100.0%
Simplified100.0%
fma-undefine99.9%
associate-+r-99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 70.5%
if -0.0315 < y < 1.74999999999999998e-4Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 97.4%
neg-mul-197.4%
sub-neg97.4%
Simplified97.4%
Final simplification81.4%
(FPCore (x y)
:precision binary64
(if (<= y -3e+30)
(* y -0.5)
(if (<= y -225.0)
(* x y)
(if (<= y 1.1)
(- 0.918938533204673 x)
(if (<= y 7e+205) (* x y) (* y -0.5))))))
double code(double x, double y) {
double tmp;
if (y <= -3e+30) {
tmp = y * -0.5;
} else if (y <= -225.0) {
tmp = x * y;
} else if (y <= 1.1) {
tmp = 0.918938533204673 - x;
} else if (y <= 7e+205) {
tmp = x * y;
} 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) :: tmp
if (y <= (-3d+30)) then
tmp = y * (-0.5d0)
else if (y <= (-225.0d0)) then
tmp = x * y
else if (y <= 1.1d0) then
tmp = 0.918938533204673d0 - x
else if (y <= 7d+205) then
tmp = x * y
else
tmp = y * (-0.5d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -3e+30) {
tmp = y * -0.5;
} else if (y <= -225.0) {
tmp = x * y;
} else if (y <= 1.1) {
tmp = 0.918938533204673 - x;
} else if (y <= 7e+205) {
tmp = x * y;
} else {
tmp = y * -0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -3e+30: tmp = y * -0.5 elif y <= -225.0: tmp = x * y elif y <= 1.1: tmp = 0.918938533204673 - x elif y <= 7e+205: tmp = x * y else: tmp = y * -0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= -3e+30) tmp = Float64(y * -0.5); elseif (y <= -225.0) tmp = Float64(x * y); elseif (y <= 1.1) tmp = Float64(0.918938533204673 - x); elseif (y <= 7e+205) tmp = Float64(x * y); else tmp = Float64(y * -0.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -3e+30) tmp = y * -0.5; elseif (y <= -225.0) tmp = x * y; elseif (y <= 1.1) tmp = 0.918938533204673 - x; elseif (y <= 7e+205) tmp = x * y; else tmp = y * -0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -3e+30], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, -225.0], N[(x * y), $MachinePrecision], If[LessEqual[y, 1.1], N[(0.918938533204673 - x), $MachinePrecision], If[LessEqual[y, 7e+205], N[(x * y), $MachinePrecision], N[(y * -0.5), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3 \cdot 10^{+30}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq -225:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;y \leq 1.1:\\
\;\;\;\;0.918938533204673 - x\\
\mathbf{elif}\;y \leq 7 \cdot 10^{+205}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;y \cdot -0.5\\
\end{array}
\end{array}
if y < -2.99999999999999978e30 or 6.9999999999999996e205 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
Taylor expanded in x around 0 64.9%
if -2.99999999999999978e30 < y < -225 or 1.1000000000000001 < y < 6.9999999999999996e205Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 94.7%
Taylor expanded in x around inf 66.9%
if -225 < y < 1.1000000000000001Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 97.4%
neg-mul-197.4%
sub-neg97.4%
Simplified97.4%
Final simplification80.6%
(FPCore (x y) :precision binary64 (if (or (<= x -17000000000000.0) (not (<= x 92000000000000.0))) (* x (+ y -1.0)) (+ (* x y) (- 0.918938533204673 (* y 0.5)))))
double code(double x, double y) {
double tmp;
if ((x <= -17000000000000.0) || !(x <= 92000000000000.0)) {
tmp = x * (y + -1.0);
} else {
tmp = (x * y) + (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 <= (-17000000000000.0d0)) .or. (.not. (x <= 92000000000000.0d0))) then
tmp = x * (y + (-1.0d0))
else
tmp = (x * y) + (0.918938533204673d0 - (y * 0.5d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -17000000000000.0) || !(x <= 92000000000000.0)) {
tmp = x * (y + -1.0);
} else {
tmp = (x * y) + (0.918938533204673 - (y * 0.5));
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -17000000000000.0) or not (x <= 92000000000000.0): tmp = x * (y + -1.0) else: tmp = (x * y) + (0.918938533204673 - (y * 0.5)) return tmp
function code(x, y) tmp = 0.0 if ((x <= -17000000000000.0) || !(x <= 92000000000000.0)) tmp = Float64(x * Float64(y + -1.0)); else tmp = Float64(Float64(x * y) + Float64(0.918938533204673 - Float64(y * 0.5))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -17000000000000.0) || ~((x <= 92000000000000.0))) tmp = x * (y + -1.0); else tmp = (x * y) + (0.918938533204673 - (y * 0.5)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -17000000000000.0], N[Not[LessEqual[x, 92000000000000.0]], $MachinePrecision]], N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] + N[(0.918938533204673 - N[(y * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -17000000000000 \lor \neg \left(x \leq 92000000000000\right):\\
\;\;\;\;x \cdot \left(y + -1\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot y + \left(0.918938533204673 - y \cdot 0.5\right)\\
\end{array}
\end{array}
if x < -1.7e13 or 9.2e13 < x Initial program 100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate-+r+100.0%
unsub-neg100.0%
associate-+l-100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
distribute-lft-out100.0%
fma-neg100.0%
+-commutative100.0%
metadata-eval100.0%
neg-sub0100.0%
associate-+l-100.0%
neg-sub0100.0%
+-commutative100.0%
unsub-neg100.0%
Simplified100.0%
fma-undefine100.0%
associate-+r-100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 100.0%
if -1.7e13 < x < 9.2e13Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 99.4%
Final simplification99.7%
(FPCore (x y) :precision binary64 (if (<= y -5e+27) (* y -0.5) (if (<= y 7.6e-179) (- x) (if (<= y 235.0) 0.918938533204673 (* y -0.5)))))
double code(double x, double y) {
double tmp;
if (y <= -5e+27) {
tmp = y * -0.5;
} else if (y <= 7.6e-179) {
tmp = -x;
} else if (y <= 235.0) {
tmp = 0.918938533204673;
} 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) :: tmp
if (y <= (-5d+27)) then
tmp = y * (-0.5d0)
else if (y <= 7.6d-179) then
tmp = -x
else if (y <= 235.0d0) then
tmp = 0.918938533204673d0
else
tmp = y * (-0.5d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -5e+27) {
tmp = y * -0.5;
} else if (y <= 7.6e-179) {
tmp = -x;
} else if (y <= 235.0) {
tmp = 0.918938533204673;
} else {
tmp = y * -0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -5e+27: tmp = y * -0.5 elif y <= 7.6e-179: tmp = -x elif y <= 235.0: tmp = 0.918938533204673 else: tmp = y * -0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= -5e+27) tmp = Float64(y * -0.5); elseif (y <= 7.6e-179) tmp = Float64(-x); elseif (y <= 235.0) tmp = 0.918938533204673; else tmp = Float64(y * -0.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -5e+27) tmp = y * -0.5; elseif (y <= 7.6e-179) tmp = -x; elseif (y <= 235.0) tmp = 0.918938533204673; else tmp = y * -0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -5e+27], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 7.6e-179], (-x), If[LessEqual[y, 235.0], 0.918938533204673, N[(y * -0.5), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{+27}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 7.6 \cdot 10^{-179}:\\
\;\;\;\;-x\\
\mathbf{elif}\;y \leq 235:\\
\;\;\;\;0.918938533204673\\
\mathbf{else}:\\
\;\;\;\;y \cdot -0.5\\
\end{array}
\end{array}
if y < -4.99999999999999979e27 or 235 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 99.3%
Taylor expanded in x around 0 54.0%
if -4.99999999999999979e27 < y < 7.59999999999999947e-179Initial program 100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate-+r+100.0%
unsub-neg100.0%
associate-+l-100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
distribute-lft-out100.0%
fma-neg100.0%
+-commutative100.0%
metadata-eval100.0%
neg-sub0100.0%
associate-+l-100.0%
neg-sub0100.0%
+-commutative100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in x around -inf 58.6%
Taylor expanded in y around 0 52.6%
neg-mul-152.6%
Simplified52.6%
if 7.59999999999999947e-179 < y < 235Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 92.1%
neg-mul-192.1%
sub-neg92.1%
Simplified92.1%
Taylor expanded in x around 0 59.9%
(FPCore (x y) :precision binary64 (if (or (<= x -0.68) (not (<= x 0.62))) (* x (+ y -1.0)) (- 0.918938533204673 (* y 0.5))))
double code(double x, double y) {
double tmp;
if ((x <= -0.68) || !(x <= 0.62)) {
tmp = 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 <= (-0.68d0)) .or. (.not. (x <= 0.62d0))) then
tmp = 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 <= -0.68) || !(x <= 0.62)) {
tmp = x * (y + -1.0);
} else {
tmp = 0.918938533204673 - (y * 0.5);
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -0.68) or not (x <= 0.62): tmp = x * (y + -1.0) else: tmp = 0.918938533204673 - (y * 0.5) return tmp
function code(x, y) tmp = 0.0 if ((x <= -0.68) || !(x <= 0.62)) tmp = 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 <= -0.68) || ~((x <= 0.62))) tmp = x * (y + -1.0); else tmp = 0.918938533204673 - (y * 0.5); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -0.68], N[Not[LessEqual[x, 0.62]], $MachinePrecision]], N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 - N[(y * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.68 \lor \neg \left(x \leq 0.62\right):\\
\;\;\;\;x \cdot \left(y + -1\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - y \cdot 0.5\\
\end{array}
\end{array}
if x < -0.680000000000000049 or 0.619999999999999996 < x Initial program 100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate-+r+100.0%
unsub-neg100.0%
associate-+l-100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
distribute-lft-out100.0%
fma-neg100.0%
+-commutative100.0%
metadata-eval100.0%
neg-sub0100.0%
associate-+l-100.0%
neg-sub0100.0%
+-commutative100.0%
unsub-neg100.0%
Simplified100.0%
fma-undefine100.0%
associate-+r-100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 98.4%
if -0.680000000000000049 < x < 0.619999999999999996Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 98.2%
*-commutative98.2%
Simplified98.2%
Final simplification98.3%
(FPCore (x y) :precision binary64 (if (or (<= y -1.6) (not (<= y 1.3))) (* y (- x 0.5)) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -1.6) || !(y <= 1.3)) {
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.6d0)) .or. (.not. (y <= 1.3d0))) 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.6) || !(y <= 1.3)) {
tmp = y * (x - 0.5);
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.6) or not (y <= 1.3): tmp = y * (x - 0.5) else: tmp = 0.918938533204673 - x return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.6) || !(y <= 1.3)) 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.6) || ~((y <= 1.3))) tmp = y * (x - 0.5); else tmp = 0.918938533204673 - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.6], N[Not[LessEqual[y, 1.3]], $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.6 \lor \neg \left(y \leq 1.3\right):\\
\;\;\;\;y \cdot \left(x - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\
\end{array}
\end{array}
if y < -1.6000000000000001 or 1.30000000000000004 < 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.6000000000000001 < y < 1.30000000000000004Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 97.4%
neg-mul-197.4%
sub-neg97.4%
Simplified97.4%
Final simplification97.7%
(FPCore (x y) :precision binary64 (if (or (<= x -160000000000.0) (not (<= x 8500000000.0))) (- x) 0.918938533204673))
double code(double x, double y) {
double tmp;
if ((x <= -160000000000.0) || !(x <= 8500000000.0)) {
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 <= (-160000000000.0d0)) .or. (.not. (x <= 8500000000.0d0))) 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 <= -160000000000.0) || !(x <= 8500000000.0)) {
tmp = -x;
} else {
tmp = 0.918938533204673;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -160000000000.0) or not (x <= 8500000000.0): tmp = -x else: tmp = 0.918938533204673 return tmp
function code(x, y) tmp = 0.0 if ((x <= -160000000000.0) || !(x <= 8500000000.0)) tmp = Float64(-x); else tmp = 0.918938533204673; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -160000000000.0) || ~((x <= 8500000000.0))) tmp = -x; else tmp = 0.918938533204673; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -160000000000.0], N[Not[LessEqual[x, 8500000000.0]], $MachinePrecision]], (-x), 0.918938533204673]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -160000000000 \lor \neg \left(x \leq 8500000000\right):\\
\;\;\;\;-x\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673\\
\end{array}
\end{array}
if x < -1.6e11 or 8.5e9 < x Initial program 100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate-+r+100.0%
unsub-neg100.0%
associate-+l-100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
distribute-lft-out100.0%
fma-neg100.0%
+-commutative100.0%
metadata-eval100.0%
neg-sub0100.0%
associate-+l-100.0%
neg-sub0100.0%
+-commutative100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in x around -inf 99.8%
Taylor expanded in y around 0 50.8%
neg-mul-150.8%
Simplified50.8%
if -1.6e11 < x < 8.5e9Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 44.5%
neg-mul-144.5%
sub-neg44.5%
Simplified44.5%
Taylor expanded in x around 0 44.0%
Final simplification47.2%
(FPCore (x y) :precision binary64 (- (+ 0.918938533204673 (* y (+ x -0.5))) x))
double code(double x, double y) {
return (0.918938533204673 + (y * (x + -0.5))) - x;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (0.918938533204673d0 + (y * (x + (-0.5d0)))) - x
end function
public static double code(double x, double y) {
return (0.918938533204673 + (y * (x + -0.5))) - x;
}
def code(x, y): return (0.918938533204673 + (y * (x + -0.5))) - x
function code(x, y) return Float64(Float64(0.918938533204673 + Float64(y * Float64(x + -0.5))) - x) end
function tmp = code(x, y) tmp = (0.918938533204673 + (y * (x + -0.5))) - x; end
code[x_, y_] := N[(N[(0.918938533204673 + N[(y * N[(x + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]
\begin{array}{l}
\\
\left(0.918938533204673 + y \cdot \left(x + -0.5\right)\right) - x
\end{array}
Initial program 100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate-+r+100.0%
unsub-neg100.0%
associate-+l-100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
distribute-lft-out100.0%
fma-neg100.0%
+-commutative100.0%
metadata-eval100.0%
neg-sub0100.0%
associate-+l-100.0%
neg-sub0100.0%
+-commutative100.0%
unsub-neg100.0%
Simplified100.0%
fma-undefine100.0%
associate-+r-100.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%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 47.5%
neg-mul-147.5%
sub-neg47.5%
Simplified47.5%
Taylor expanded in x around 0 24.3%
herbie shell --seed 2024139
(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))