
(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 (- (+ (* 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%
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%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* x (+ y -1.0))))
(if (<= x -2.5e-19)
t_0
(if (<= x -9.5e-79)
(* y -0.5)
(if (<= x 2100000000.0) (- 0.918938533204673 x) t_0)))))
double code(double x, double y) {
double t_0 = x * (y + -1.0);
double tmp;
if (x <= -2.5e-19) {
tmp = t_0;
} else if (x <= -9.5e-79) {
tmp = y * -0.5;
} else if (x <= 2100000000.0) {
tmp = 0.918938533204673 - x;
} else {
tmp = t_0;
}
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 (x <= (-2.5d-19)) then
tmp = t_0
else if (x <= (-9.5d-79)) then
tmp = y * (-0.5d0)
else if (x <= 2100000000.0d0) then
tmp = 0.918938533204673d0 - x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x * (y + -1.0);
double tmp;
if (x <= -2.5e-19) {
tmp = t_0;
} else if (x <= -9.5e-79) {
tmp = y * -0.5;
} else if (x <= 2100000000.0) {
tmp = 0.918938533204673 - x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = x * (y + -1.0) tmp = 0 if x <= -2.5e-19: tmp = t_0 elif x <= -9.5e-79: tmp = y * -0.5 elif x <= 2100000000.0: tmp = 0.918938533204673 - x else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(x * Float64(y + -1.0)) tmp = 0.0 if (x <= -2.5e-19) tmp = t_0; elseif (x <= -9.5e-79) tmp = Float64(y * -0.5); elseif (x <= 2100000000.0) tmp = Float64(0.918938533204673 - x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = x * (y + -1.0); tmp = 0.0; if (x <= -2.5e-19) tmp = t_0; elseif (x <= -9.5e-79) tmp = y * -0.5; elseif (x <= 2100000000.0) tmp = 0.918938533204673 - x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.5e-19], t$95$0, If[LessEqual[x, -9.5e-79], N[(y * -0.5), $MachinePrecision], If[LessEqual[x, 2100000000.0], N[(0.918938533204673 - x), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(y + -1\right)\\
\mathbf{if}\;x \leq -2.5 \cdot 10^{-19}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -9.5 \cdot 10^{-79}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;x \leq 2100000000:\\
\;\;\;\;0.918938533204673 - x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -2.5000000000000002e-19 or 2.1e9 < 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.2%
if -2.5000000000000002e-19 < x < -9.4999999999999997e-79Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 73.3%
Taylor expanded in x around 0 73.3%
if -9.4999999999999997e-79 < x < 2.1e9Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 53.7%
neg-mul-153.7%
sub-neg53.7%
Simplified53.7%
Final simplification80.3%
(FPCore (x y)
:precision binary64
(if (<= y -35.0)
(* y x)
(if (<= y 1.05)
(- 0.918938533204673 x)
(if (<= y 1.9e+180) (* y x) (* y -0.5)))))
double code(double x, double y) {
double tmp;
if (y <= -35.0) {
tmp = y * x;
} else if (y <= 1.05) {
tmp = 0.918938533204673 - x;
} else if (y <= 1.9e+180) {
tmp = y * x;
} 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 <= (-35.0d0)) then
tmp = y * x
else if (y <= 1.05d0) then
tmp = 0.918938533204673d0 - x
else if (y <= 1.9d+180) then
tmp = y * x
else
tmp = y * (-0.5d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -35.0) {
tmp = y * x;
} else if (y <= 1.05) {
tmp = 0.918938533204673 - x;
} else if (y <= 1.9e+180) {
tmp = y * x;
} else {
tmp = y * -0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -35.0: tmp = y * x elif y <= 1.05: tmp = 0.918938533204673 - x elif y <= 1.9e+180: tmp = y * x else: tmp = y * -0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= -35.0) tmp = Float64(y * x); elseif (y <= 1.05) tmp = Float64(0.918938533204673 - x); elseif (y <= 1.9e+180) tmp = Float64(y * x); else tmp = Float64(y * -0.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -35.0) tmp = y * x; elseif (y <= 1.05) tmp = 0.918938533204673 - x; elseif (y <= 1.9e+180) tmp = y * x; else tmp = y * -0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -35.0], N[(y * x), $MachinePrecision], If[LessEqual[y, 1.05], N[(0.918938533204673 - x), $MachinePrecision], If[LessEqual[y, 1.9e+180], N[(y * x), $MachinePrecision], N[(y * -0.5), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -35:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq 1.05:\\
\;\;\;\;0.918938533204673 - x\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{+180}:\\
\;\;\;\;y \cdot x\\
\mathbf{else}:\\
\;\;\;\;y \cdot -0.5\\
\end{array}
\end{array}
if y < -35 or 1.05000000000000004 < y < 1.9e180Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 97.0%
Taylor expanded in x around inf 57.2%
*-commutative57.2%
Simplified57.2%
if -35 < y < 1.05000000000000004Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 97.7%
neg-mul-197.7%
sub-neg97.7%
Simplified97.7%
if 1.9e180 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 99.9%
Taylor expanded in x around 0 62.2%
(FPCore (x y) :precision binary64 (if (<= y -0.0041) (* y x) (if (<= y 0.0018) (- x) (if (<= y 1.02e+182) (* y x) (* y -0.5)))))
double code(double x, double y) {
double tmp;
if (y <= -0.0041) {
tmp = y * x;
} else if (y <= 0.0018) {
tmp = -x;
} else if (y <= 1.02e+182) {
tmp = y * x;
} 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 <= (-0.0041d0)) then
tmp = y * x
else if (y <= 0.0018d0) then
tmp = -x
else if (y <= 1.02d+182) then
tmp = y * x
else
tmp = y * (-0.5d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -0.0041) {
tmp = y * x;
} else if (y <= 0.0018) {
tmp = -x;
} else if (y <= 1.02e+182) {
tmp = y * x;
} else {
tmp = y * -0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -0.0041: tmp = y * x elif y <= 0.0018: tmp = -x elif y <= 1.02e+182: tmp = y * x else: tmp = y * -0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= -0.0041) tmp = Float64(y * x); elseif (y <= 0.0018) tmp = Float64(-x); elseif (y <= 1.02e+182) tmp = Float64(y * x); else tmp = Float64(y * -0.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -0.0041) tmp = y * x; elseif (y <= 0.0018) tmp = -x; elseif (y <= 1.02e+182) tmp = y * x; else tmp = y * -0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -0.0041], N[(y * x), $MachinePrecision], If[LessEqual[y, 0.0018], (-x), If[LessEqual[y, 1.02e+182], N[(y * x), $MachinePrecision], N[(y * -0.5), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.0041:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq 0.0018:\\
\;\;\;\;-x\\
\mathbf{elif}\;y \leq 1.02 \cdot 10^{+182}:\\
\;\;\;\;y \cdot x\\
\mathbf{else}:\\
\;\;\;\;y \cdot -0.5\\
\end{array}
\end{array}
if y < -0.00410000000000000035 or 0.0018 < y < 1.02e182Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 94.3%
Taylor expanded in x around inf 55.5%
*-commutative55.5%
Simplified55.5%
if -0.00410000000000000035 < y < 0.0018Initial 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 60.3%
Taylor expanded in y around 0 59.9%
neg-mul-159.9%
Simplified59.9%
if 1.02e182 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 99.9%
Taylor expanded in x around 0 62.2%
(FPCore (x y) :precision binary64 (if (or (<= x -1.5e-7) (not (<= x 0.41))) (- (+ 0.918938533204673 (* y x)) x) (- 0.918938533204673 (* y 0.5))))
double code(double x, double y) {
double tmp;
if ((x <= -1.5e-7) || !(x <= 0.41)) {
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 <= (-1.5d-7)) .or. (.not. (x <= 0.41d0))) 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 <= -1.5e-7) || !(x <= 0.41)) {
tmp = (0.918938533204673 + (y * x)) - x;
} else {
tmp = 0.918938533204673 - (y * 0.5);
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -1.5e-7) or not (x <= 0.41): tmp = (0.918938533204673 + (y * x)) - x else: tmp = 0.918938533204673 - (y * 0.5) return tmp
function code(x, y) tmp = 0.0 if ((x <= -1.5e-7) || !(x <= 0.41)) 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 <= -1.5e-7) || ~((x <= 0.41))) 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, -1.5e-7], N[Not[LessEqual[x, 0.41]], $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 -1.5 \cdot 10^{-7} \lor \neg \left(x \leq 0.41\right):\\
\;\;\;\;\left(0.918938533204673 + y \cdot x\right) - x\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - y \cdot 0.5\\
\end{array}
\end{array}
if x < -1.4999999999999999e-7 or 0.409999999999999976 < 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 99.8%
if -1.4999999999999999e-7 < x < 0.409999999999999976Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 99.3%
*-commutative99.3%
Simplified99.3%
Final simplification99.6%
(FPCore (x y)
:precision binary64
(if (<= x -2.5e-19)
(- x)
(if (<= x -5.2e-77)
(* y -0.5)
(if (<= x 3.1e-17) 0.918938533204673 (- x)))))
double code(double x, double y) {
double tmp;
if (x <= -2.5e-19) {
tmp = -x;
} else if (x <= -5.2e-77) {
tmp = y * -0.5;
} else if (x <= 3.1e-17) {
tmp = 0.918938533204673;
} else {
tmp = -x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-2.5d-19)) then
tmp = -x
else if (x <= (-5.2d-77)) then
tmp = y * (-0.5d0)
else if (x <= 3.1d-17) then
tmp = 0.918938533204673d0
else
tmp = -x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -2.5e-19) {
tmp = -x;
} else if (x <= -5.2e-77) {
tmp = y * -0.5;
} else if (x <= 3.1e-17) {
tmp = 0.918938533204673;
} else {
tmp = -x;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -2.5e-19: tmp = -x elif x <= -5.2e-77: tmp = y * -0.5 elif x <= 3.1e-17: tmp = 0.918938533204673 else: tmp = -x return tmp
function code(x, y) tmp = 0.0 if (x <= -2.5e-19) tmp = Float64(-x); elseif (x <= -5.2e-77) tmp = Float64(y * -0.5); elseif (x <= 3.1e-17) tmp = 0.918938533204673; else tmp = Float64(-x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -2.5e-19) tmp = -x; elseif (x <= -5.2e-77) tmp = y * -0.5; elseif (x <= 3.1e-17) tmp = 0.918938533204673; else tmp = -x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -2.5e-19], (-x), If[LessEqual[x, -5.2e-77], N[(y * -0.5), $MachinePrecision], If[LessEqual[x, 3.1e-17], 0.918938533204673, (-x)]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.5 \cdot 10^{-19}:\\
\;\;\;\;-x\\
\mathbf{elif}\;x \leq -5.2 \cdot 10^{-77}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;x \leq 3.1 \cdot 10^{-17}:\\
\;\;\;\;0.918938533204673\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
\end{array}
if x < -2.5000000000000002e-19 or 3.0999999999999998e-17 < 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 96.4%
Taylor expanded in y around 0 54.5%
neg-mul-154.5%
Simplified54.5%
if -2.5000000000000002e-19 < x < -5.2000000000000002e-77Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 73.3%
Taylor expanded in x around 0 73.3%
if -5.2000000000000002e-77 < x < 3.0999999999999998e-17Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in y around 0 54.4%
(FPCore (x y) :precision binary64 (if (or (<= x -0.67) (not (<= x 0.85))) (- (* y x) x) (- 0.918938533204673 (* y 0.5))))
double code(double x, double y) {
double tmp;
if ((x <= -0.67) || !(x <= 0.85)) {
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.67d0)) .or. (.not. (x <= 0.85d0))) 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.67) || !(x <= 0.85)) {
tmp = (y * x) - x;
} else {
tmp = 0.918938533204673 - (y * 0.5);
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -0.67) or not (x <= 0.85): tmp = (y * x) - x else: tmp = 0.918938533204673 - (y * 0.5) return tmp
function code(x, y) tmp = 0.0 if ((x <= -0.67) || !(x <= 0.85)) 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.67) || ~((x <= 0.85))) tmp = (y * x) - x; else tmp = 0.918938533204673 - (y * 0.5); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -0.67], N[Not[LessEqual[x, 0.85]], $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.67 \lor \neg \left(x \leq 0.85\right):\\
\;\;\;\;y \cdot x - x\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - y \cdot 0.5\\
\end{array}
\end{array}
if x < -0.67000000000000004 or 0.849999999999999978 < 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.9%
sub-neg98.9%
distribute-rgt-in98.9%
metadata-eval98.9%
neg-mul-198.9%
Applied egg-rr98.9%
Taylor expanded in y around 0 98.9%
if -0.67000000000000004 < x < 0.849999999999999978Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 98.6%
*-commutative98.6%
Simplified98.6%
Final simplification98.7%
(FPCore (x y) :precision binary64 (if (or (<= x -0.68) (not (<= x 0.5))) (* x (+ y -1.0)) (- 0.918938533204673 (* y 0.5))))
double code(double x, double y) {
double tmp;
if ((x <= -0.68) || !(x <= 0.5)) {
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.5d0))) 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.5)) {
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.5): 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.5)) 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.5))) 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.5]], $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.5\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.5 < 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.9%
if -0.680000000000000049 < x < 0.5Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 98.6%
*-commutative98.6%
Simplified98.6%
Final simplification98.7%
(FPCore (x y) :precision binary64 (if (or (<= y -1.3) (not (<= y 1.15))) (* y (- x 0.5)) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -1.3) || !(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.3d0)) .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.3) || !(y <= 1.15)) {
tmp = y * (x - 0.5);
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.3) 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.3) || !(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.3) || ~((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.3], 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.3 \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.30000000000000004 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.0%
if -1.30000000000000004 < y < 1.1499999999999999Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 98.3%
neg-mul-198.3%
sub-neg98.3%
Simplified98.3%
Final simplification97.7%
(FPCore (x y) :precision binary64 (if (or (<= x -0.92) (not (<= x 3.1e-17))) (- x) 0.918938533204673))
double code(double x, double y) {
double tmp;
if ((x <= -0.92) || !(x <= 3.1e-17)) {
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 <= 3.1d-17))) 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 <= 3.1e-17)) {
tmp = -x;
} else {
tmp = 0.918938533204673;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -0.92) or not (x <= 3.1e-17): tmp = -x else: tmp = 0.918938533204673 return tmp
function code(x, y) tmp = 0.0 if ((x <= -0.92) || !(x <= 3.1e-17)) 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 <= 3.1e-17))) tmp = -x; else tmp = 0.918938533204673; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -0.92], N[Not[LessEqual[x, 3.1e-17]], $MachinePrecision]], (-x), 0.918938533204673]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.92 \lor \neg \left(x \leq 3.1 \cdot 10^{-17}\right):\\
\;\;\;\;-x\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673\\
\end{array}
\end{array}
if x < -0.92000000000000004 or 3.0999999999999998e-17 < 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 97.5%
Taylor expanded in y around 0 55.1%
neg-mul-155.1%
Simplified55.1%
if -0.92000000000000004 < x < 3.0999999999999998e-17Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 99.3%
*-commutative99.3%
Simplified99.3%
Taylor expanded in y around 0 50.2%
Final simplification53.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 x around 0 45.0%
*-commutative45.0%
Simplified45.0%
Taylor expanded in y around 0 23.2%
herbie shell --seed 2024137
(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))