
(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 10 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
(if (<= x -620000000000.0)
(- (* y x) x)
(if (<= x 1800000000.0)
(+ 0.918938533204673 (- (* y -0.5) x))
(* x (+ y -1.0)))))
double code(double x, double y) {
double tmp;
if (x <= -620000000000.0) {
tmp = (y * x) - x;
} else if (x <= 1800000000.0) {
tmp = 0.918938533204673 + ((y * -0.5) - x);
} else {
tmp = x * (y + -1.0);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-620000000000.0d0)) then
tmp = (y * x) - x
else if (x <= 1800000000.0d0) then
tmp = 0.918938533204673d0 + ((y * (-0.5d0)) - x)
else
tmp = x * (y + (-1.0d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -620000000000.0) {
tmp = (y * x) - x;
} else if (x <= 1800000000.0) {
tmp = 0.918938533204673 + ((y * -0.5) - x);
} else {
tmp = x * (y + -1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -620000000000.0: tmp = (y * x) - x elif x <= 1800000000.0: tmp = 0.918938533204673 + ((y * -0.5) - x) else: tmp = x * (y + -1.0) return tmp
function code(x, y) tmp = 0.0 if (x <= -620000000000.0) tmp = Float64(Float64(y * x) - x); elseif (x <= 1800000000.0) tmp = Float64(0.918938533204673 + Float64(Float64(y * -0.5) - x)); else tmp = Float64(x * Float64(y + -1.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -620000000000.0) tmp = (y * x) - x; elseif (x <= 1800000000.0) tmp = 0.918938533204673 + ((y * -0.5) - x); else tmp = x * (y + -1.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -620000000000.0], N[(N[(y * x), $MachinePrecision] - x), $MachinePrecision], If[LessEqual[x, 1800000000.0], N[(0.918938533204673 + N[(N[(y * -0.5), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision], N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -620000000000:\\
\;\;\;\;y \cdot x - x\\
\mathbf{elif}\;x \leq 1800000000:\\
\;\;\;\;0.918938533204673 + \left(y \cdot -0.5 - x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y + -1\right)\\
\end{array}
\end{array}
if x < -6.2e11Initial program 99.9%
associate-+l-99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around inf 99.5%
sub-neg99.5%
distribute-rgt-in99.5%
metadata-eval99.5%
neg-mul-199.5%
Applied egg-rr99.5%
unsub-neg99.5%
Applied egg-rr99.5%
if -6.2e11 < x < 1.8e9Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
cancel-sign-sub-inv100.0%
metadata-eval100.0%
sub-neg100.0%
metadata-eval100.0%
associate-+r+100.0%
distribute-lft-in100.0%
*-commutative100.0%
neg-mul-1100.0%
+-commutative100.0%
associate-+l+100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
sub-neg100.0%
+-commutative100.0%
unsub-neg100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 99.1%
*-commutative99.1%
Simplified99.1%
if 1.8e9 < x Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
Final simplification99.4%
(FPCore (x y) :precision binary64 (if (or (<= y -1.1e-11) (not (<= y 2e-38))) (* x (+ y -1.0)) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -1.1e-11) || !(y <= 2e-38)) {
tmp = x * (y + -1.0);
} 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.1d-11)) .or. (.not. (y <= 2d-38))) then
tmp = x * (y + (-1.0d0))
else
tmp = 0.918938533204673d0 - x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -1.1e-11) || !(y <= 2e-38)) {
tmp = x * (y + -1.0);
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.1e-11) or not (y <= 2e-38): tmp = x * (y + -1.0) else: tmp = 0.918938533204673 - x return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.1e-11) || !(y <= 2e-38)) tmp = Float64(x * Float64(y + -1.0)); else tmp = Float64(0.918938533204673 - x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1.1e-11) || ~((y <= 2e-38))) tmp = x * (y + -1.0); else tmp = 0.918938533204673 - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.1e-11], N[Not[LessEqual[y, 2e-38]], $MachinePrecision]], N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.1 \cdot 10^{-11} \lor \neg \left(y \leq 2 \cdot 10^{-38}\right):\\
\;\;\;\;x \cdot \left(y + -1\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\
\end{array}
\end{array}
if y < -1.1000000000000001e-11 or 1.9999999999999999e-38 < y Initial program 99.9%
associate-+l-99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around inf 56.4%
if -1.1000000000000001e-11 < y < 1.9999999999999999e-38Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Final simplification78.0%
(FPCore (x y) :precision binary64 (if (or (<= y -1.5) (not (<= y 1.15))) (* y (- x 0.5)) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -1.5) || !(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.5d0)) .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.5) || !(y <= 1.15)) {
tmp = y * (x - 0.5);
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.5) 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.5) || !(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.5) || ~((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.5], 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.5 \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.5 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 98.1%
if -1.5 < y < 1.1499999999999999Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 97.5%
neg-mul-197.5%
unsub-neg97.5%
Simplified97.5%
Final simplification97.8%
(FPCore (x y) :precision binary64 (if (or (<= x -0.72) (not (<= x 0.6))) (* x (+ y -1.0)) (- 0.918938533204673 (* y 0.5))))
double code(double x, double y) {
double tmp;
if ((x <= -0.72) || !(x <= 0.6)) {
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.72d0)) .or. (.not. (x <= 0.6d0))) 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.72) || !(x <= 0.6)) {
tmp = x * (y + -1.0);
} else {
tmp = 0.918938533204673 - (y * 0.5);
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -0.72) or not (x <= 0.6): tmp = x * (y + -1.0) else: tmp = 0.918938533204673 - (y * 0.5) return tmp
function code(x, y) tmp = 0.0 if ((x <= -0.72) || !(x <= 0.6)) 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.72) || ~((x <= 0.6))) 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.72], N[Not[LessEqual[x, 0.6]], $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.72 \lor \neg \left(x \leq 0.6\right):\\
\;\;\;\;x \cdot \left(y + -1\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - y \cdot 0.5\\
\end{array}
\end{array}
if x < -0.71999999999999997 or 0.599999999999999978 < x Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 99.6%
if -0.71999999999999997 < x < 0.599999999999999978Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 98.8%
Final simplification99.2%
(FPCore (x y) :precision binary64 (if (<= x -0.8) (- (* y x) x) (if (<= x 0.65) (- 0.918938533204673 (* y 0.5)) (* x (+ y -1.0)))))
double code(double x, double y) {
double tmp;
if (x <= -0.8) {
tmp = (y * x) - x;
} else if (x <= 0.65) {
tmp = 0.918938533204673 - (y * 0.5);
} else {
tmp = x * (y + -1.0);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-0.8d0)) then
tmp = (y * x) - x
else if (x <= 0.65d0) then
tmp = 0.918938533204673d0 - (y * 0.5d0)
else
tmp = x * (y + (-1.0d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -0.8) {
tmp = (y * x) - x;
} else if (x <= 0.65) {
tmp = 0.918938533204673 - (y * 0.5);
} else {
tmp = x * (y + -1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -0.8: tmp = (y * x) - x elif x <= 0.65: tmp = 0.918938533204673 - (y * 0.5) else: tmp = x * (y + -1.0) return tmp
function code(x, y) tmp = 0.0 if (x <= -0.8) tmp = Float64(Float64(y * x) - x); elseif (x <= 0.65) tmp = Float64(0.918938533204673 - Float64(y * 0.5)); else tmp = Float64(x * Float64(y + -1.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -0.8) tmp = (y * x) - x; elseif (x <= 0.65) tmp = 0.918938533204673 - (y * 0.5); else tmp = x * (y + -1.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -0.8], N[(N[(y * x), $MachinePrecision] - x), $MachinePrecision], If[LessEqual[x, 0.65], N[(0.918938533204673 - N[(y * 0.5), $MachinePrecision]), $MachinePrecision], N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.8:\\
\;\;\;\;y \cdot x - x\\
\mathbf{elif}\;x \leq 0.65:\\
\;\;\;\;0.918938533204673 - y \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y + -1\right)\\
\end{array}
\end{array}
if x < -0.80000000000000004Initial program 99.9%
associate-+l-99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around inf 99.2%
sub-neg99.2%
distribute-rgt-in99.2%
metadata-eval99.2%
neg-mul-199.2%
Applied egg-rr99.2%
unsub-neg99.2%
Applied egg-rr99.2%
if -0.80000000000000004 < x < 0.650000000000000022Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 98.8%
if 0.650000000000000022 < x Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
Final simplification99.3%
(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(0.918938533204673 + Float64(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[(0.918938533204673 + N[(N[(y * N[(x + -0.5), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.918938533204673 + \left(y \cdot \left(x + -0.5\right) - x\right)
\end{array}
Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
cancel-sign-sub-inv100.0%
metadata-eval100.0%
sub-neg100.0%
metadata-eval100.0%
associate-+r+100.0%
distribute-lft-in100.0%
*-commutative100.0%
neg-mul-1100.0%
+-commutative100.0%
associate-+l+100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
sub-neg100.0%
+-commutative100.0%
unsub-neg100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y) :precision binary64 (if (or (<= y -1.0) (not (<= y 1.0))) (* y x) (- x)))
double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 1.0)) {
tmp = y * x;
} 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 ((y <= (-1.0d0)) .or. (.not. (y <= 1.0d0))) then
tmp = y * x
else
tmp = -x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 1.0)) {
tmp = y * x;
} else {
tmp = -x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.0) or not (y <= 1.0): tmp = y * x else: tmp = -x return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.0) || !(y <= 1.0)) tmp = Float64(y * x); else tmp = Float64(-x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1.0) || ~((y <= 1.0))) tmp = y * x; else tmp = -x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 1.0]], $MachinePrecision]], N[(y * x), $MachinePrecision], (-x)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 1\right):\\
\;\;\;\;y \cdot x\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
\end{array}
if y < -1 or 1 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 53.5%
sub-neg53.5%
distribute-rgt-in53.4%
metadata-eval53.4%
neg-mul-153.4%
Applied egg-rr53.4%
Taylor expanded in y around inf 52.7%
if -1 < y < 1Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 54.1%
sub-neg54.1%
distribute-rgt-in54.2%
metadata-eval54.2%
neg-mul-154.2%
Applied egg-rr54.2%
Taylor expanded in y around 0 52.1%
mul-1-neg52.1%
Simplified52.1%
Final simplification52.4%
(FPCore (x y) :precision binary64 (if (or (<= y -70000000.0) (not (<= y 1.65))) (* y x) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -70000000.0) || !(y <= 1.65)) {
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 <= (-70000000.0d0)) .or. (.not. (y <= 1.65d0))) 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 <= -70000000.0) || !(y <= 1.65)) {
tmp = y * x;
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -70000000.0) or not (y <= 1.65): tmp = y * x else: tmp = 0.918938533204673 - x return tmp
function code(x, y) tmp = 0.0 if ((y <= -70000000.0) || !(y <= 1.65)) 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 <= -70000000.0) || ~((y <= 1.65))) tmp = y * x; else tmp = 0.918938533204673 - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -70000000.0], N[Not[LessEqual[y, 1.65]], $MachinePrecision]], N[(y * x), $MachinePrecision], N[(0.918938533204673 - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -70000000 \lor \neg \left(y \leq 1.65\right):\\
\;\;\;\;y \cdot x\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\
\end{array}
\end{array}
if y < -7e7 or 1.6499999999999999 < y Initial program 99.9%
associate-+l-99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around inf 53.9%
sub-neg53.9%
distribute-rgt-in53.8%
metadata-eval53.8%
neg-mul-153.8%
Applied egg-rr53.8%
Taylor expanded in y around inf 53.1%
if -7e7 < y < 1.6499999999999999Initial 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%
unsub-neg96.9%
Simplified96.9%
Final simplification76.7%
(FPCore (x y) :precision binary64 (- x))
double code(double x, double y) {
return -x;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = -x
end function
public static double code(double x, double y) {
return -x;
}
def code(x, y): return -x
function code(x, y) return Float64(-x) end
function tmp = code(x, y) tmp = -x; end
code[x_, y_] := (-x)
\begin{array}{l}
\\
-x
\end{array}
Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 53.8%
sub-neg53.8%
distribute-rgt-in53.8%
metadata-eval53.8%
neg-mul-153.8%
Applied egg-rr53.8%
Taylor expanded in y around 0 29.2%
mul-1-neg29.2%
Simplified29.2%
Final simplification29.2%
herbie shell --seed 2023318
(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))