
(FPCore (x y) :precision binary64 (+ (- (* x (- y 1.0)) (* y 0.5)) 0.918938533204673))
double code(double x, double y) {
return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x * (y - 1.0d0)) - (y * 0.5d0)) + 0.918938533204673d0
end function
public static double code(double x, double y) {
return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673;
}
def code(x, y): return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673
function code(x, y) return Float64(Float64(Float64(x * Float64(y - 1.0)) - Float64(y * 0.5)) + 0.918938533204673) end
function tmp = code(x, y) tmp = ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673; end
code[x_, y_] := N[(N[(N[(x * N[(y - 1.0), $MachinePrecision]), $MachinePrecision] - N[(y * 0.5), $MachinePrecision]), $MachinePrecision] + 0.918938533204673), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (+ (- (* x (- y 1.0)) (* y 0.5)) 0.918938533204673))
double code(double x, double y) {
return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x * (y - 1.0d0)) - (y * 0.5d0)) + 0.918938533204673d0
end function
public static double code(double x, double y) {
return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673;
}
def code(x, y): return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673
function code(x, y) return Float64(Float64(Float64(x * Float64(y - 1.0)) - Float64(y * 0.5)) + 0.918938533204673) end
function tmp = code(x, y) tmp = ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673; end
code[x_, y_] := N[(N[(N[(x * N[(y - 1.0), $MachinePrecision]), $MachinePrecision] - N[(y * 0.5), $MachinePrecision]), $MachinePrecision] + 0.918938533204673), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673
\end{array}
(FPCore (x y) :precision binary64 (+ (- (* 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 -3.7e+224)
(* y -0.5)
(if (<= y -11.5)
(* x y)
(if (<= y 1.85)
0.918938533204673
(if (or (<= y 2e+91) (not (<= y 3.8e+228))) (* x y) (* y -0.5))))))
double code(double x, double y) {
double tmp;
if (y <= -3.7e+224) {
tmp = y * -0.5;
} else if (y <= -11.5) {
tmp = x * y;
} else if (y <= 1.85) {
tmp = 0.918938533204673;
} else if ((y <= 2e+91) || !(y <= 3.8e+228)) {
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 <= (-3.7d+224)) then
tmp = y * (-0.5d0)
else if (y <= (-11.5d0)) then
tmp = x * y
else if (y <= 1.85d0) then
tmp = 0.918938533204673d0
else if ((y <= 2d+91) .or. (.not. (y <= 3.8d+228))) 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 <= -3.7e+224) {
tmp = y * -0.5;
} else if (y <= -11.5) {
tmp = x * y;
} else if (y <= 1.85) {
tmp = 0.918938533204673;
} else if ((y <= 2e+91) || !(y <= 3.8e+228)) {
tmp = x * y;
} else {
tmp = y * -0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -3.7e+224: tmp = y * -0.5 elif y <= -11.5: tmp = x * y elif y <= 1.85: tmp = 0.918938533204673 elif (y <= 2e+91) or not (y <= 3.8e+228): tmp = x * y else: tmp = y * -0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= -3.7e+224) tmp = Float64(y * -0.5); elseif (y <= -11.5) tmp = Float64(x * y); elseif (y <= 1.85) tmp = 0.918938533204673; elseif ((y <= 2e+91) || !(y <= 3.8e+228)) 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 <= -3.7e+224) tmp = y * -0.5; elseif (y <= -11.5) tmp = x * y; elseif (y <= 1.85) tmp = 0.918938533204673; elseif ((y <= 2e+91) || ~((y <= 3.8e+228))) tmp = x * y; else tmp = y * -0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -3.7e+224], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, -11.5], N[(x * y), $MachinePrecision], If[LessEqual[y, 1.85], 0.918938533204673, If[Or[LessEqual[y, 2e+91], N[Not[LessEqual[y, 3.8e+228]], $MachinePrecision]], N[(x * y), $MachinePrecision], N[(y * -0.5), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.7 \cdot 10^{+224}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq -11.5:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;y \leq 1.85:\\
\;\;\;\;0.918938533204673\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+91} \lor \neg \left(y \leq 3.8 \cdot 10^{+228}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;y \cdot -0.5\\
\end{array}
\end{array}
if y < -3.70000000000000003e224 or 2.00000000000000016e91 < y < 3.8000000000000002e228Initial 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 68.5%
*-commutative68.5%
Simplified68.5%
if -3.70000000000000003e224 < y < -11.5 or 1.8500000000000001 < y < 2.00000000000000016e91 or 3.8000000000000002e228 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 97.7%
Taylor expanded in x around inf 61.7%
*-commutative61.7%
Simplified61.7%
if -11.5 < 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 x around 0 62.6%
*-commutative62.6%
Simplified62.6%
Taylor expanded in y around 0 60.1%
Final simplification62.0%
(FPCore (x y)
:precision binary64
(if (<= y -2.5e+226)
(* y -0.5)
(if (<= y -30.5)
(* x y)
(if (<= y 1.55)
(- 0.918938533204673 x)
(if (or (<= y 2.2e+85) (not (<= y 1.22e+231))) (* x y) (* y -0.5))))))
double code(double x, double y) {
double tmp;
if (y <= -2.5e+226) {
tmp = y * -0.5;
} else if (y <= -30.5) {
tmp = x * y;
} else if (y <= 1.55) {
tmp = 0.918938533204673 - x;
} else if ((y <= 2.2e+85) || !(y <= 1.22e+231)) {
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 <= (-2.5d+226)) then
tmp = y * (-0.5d0)
else if (y <= (-30.5d0)) then
tmp = x * y
else if (y <= 1.55d0) then
tmp = 0.918938533204673d0 - x
else if ((y <= 2.2d+85) .or. (.not. (y <= 1.22d+231))) 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 <= -2.5e+226) {
tmp = y * -0.5;
} else if (y <= -30.5) {
tmp = x * y;
} else if (y <= 1.55) {
tmp = 0.918938533204673 - x;
} else if ((y <= 2.2e+85) || !(y <= 1.22e+231)) {
tmp = x * y;
} else {
tmp = y * -0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -2.5e+226: tmp = y * -0.5 elif y <= -30.5: tmp = x * y elif y <= 1.55: tmp = 0.918938533204673 - x elif (y <= 2.2e+85) or not (y <= 1.22e+231): tmp = x * y else: tmp = y * -0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= -2.5e+226) tmp = Float64(y * -0.5); elseif (y <= -30.5) tmp = Float64(x * y); elseif (y <= 1.55) tmp = Float64(0.918938533204673 - x); elseif ((y <= 2.2e+85) || !(y <= 1.22e+231)) 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 <= -2.5e+226) tmp = y * -0.5; elseif (y <= -30.5) tmp = x * y; elseif (y <= 1.55) tmp = 0.918938533204673 - x; elseif ((y <= 2.2e+85) || ~((y <= 1.22e+231))) tmp = x * y; else tmp = y * -0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -2.5e+226], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, -30.5], N[(x * y), $MachinePrecision], If[LessEqual[y, 1.55], N[(0.918938533204673 - x), $MachinePrecision], If[Or[LessEqual[y, 2.2e+85], N[Not[LessEqual[y, 1.22e+231]], $MachinePrecision]], N[(x * y), $MachinePrecision], N[(y * -0.5), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.5 \cdot 10^{+226}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq -30.5:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;y \leq 1.55:\\
\;\;\;\;0.918938533204673 - x\\
\mathbf{elif}\;y \leq 2.2 \cdot 10^{+85} \lor \neg \left(y \leq 1.22 \cdot 10^{+231}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;y \cdot -0.5\\
\end{array}
\end{array}
if y < -2.5000000000000002e226 or 2.2000000000000002e85 < y < 1.21999999999999998e231Initial 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 68.5%
*-commutative68.5%
Simplified68.5%
if -2.5000000000000002e226 < y < -30.5 or 1.55000000000000004 < y < 2.2000000000000002e85 or 1.21999999999999998e231 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 97.7%
Taylor expanded in x around inf 61.7%
*-commutative61.7%
Simplified61.7%
if -30.5 < y < 1.55000000000000004Initial 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 97.0%
Final simplification81.1%
(FPCore (x y) :precision binary64 (if (or (<= x -3.2e-10) (not (<= x 6.2e-12))) (- (* x (+ y -1.0)) -0.918938533204673) (- 0.918938533204673 (* y 0.5))))
double code(double x, double y) {
double tmp;
if ((x <= -3.2e-10) || !(x <= 6.2e-12)) {
tmp = (x * (y + -1.0)) - -0.918938533204673;
} 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 <= (-3.2d-10)) .or. (.not. (x <= 6.2d-12))) then
tmp = (x * (y + (-1.0d0))) - (-0.918938533204673d0)
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 <= -3.2e-10) || !(x <= 6.2e-12)) {
tmp = (x * (y + -1.0)) - -0.918938533204673;
} else {
tmp = 0.918938533204673 - (y * 0.5);
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -3.2e-10) or not (x <= 6.2e-12): tmp = (x * (y + -1.0)) - -0.918938533204673 else: tmp = 0.918938533204673 - (y * 0.5) return tmp
function code(x, y) tmp = 0.0 if ((x <= -3.2e-10) || !(x <= 6.2e-12)) tmp = Float64(Float64(x * Float64(y + -1.0)) - -0.918938533204673); else tmp = Float64(0.918938533204673 - Float64(y * 0.5)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -3.2e-10) || ~((x <= 6.2e-12))) tmp = (x * (y + -1.0)) - -0.918938533204673; else tmp = 0.918938533204673 - (y * 0.5); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -3.2e-10], N[Not[LessEqual[x, 6.2e-12]], $MachinePrecision]], N[(N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision] - -0.918938533204673), $MachinePrecision], N[(0.918938533204673 - N[(y * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.2 \cdot 10^{-10} \lor \neg \left(x \leq 6.2 \cdot 10^{-12}\right):\\
\;\;\;\;x \cdot \left(y + -1\right) - -0.918938533204673\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - y \cdot 0.5\\
\end{array}
\end{array}
if x < -3.19999999999999981e-10 or 6.2000000000000002e-12 < x Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 98.0%
if -3.19999999999999981e-10 < x < 6.2000000000000002e-12Initial 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.9%
*-commutative99.9%
Simplified99.9%
Final simplification99.0%
(FPCore (x y) :precision binary64 (if (<= y -1.4) (* y (- x 0.5)) (if (<= y 1.0) (- 0.918938533204673 x) (+ (* x y) (* y -0.5)))))
double code(double x, double y) {
double tmp;
if (y <= -1.4) {
tmp = y * (x - 0.5);
} else if (y <= 1.0) {
tmp = 0.918938533204673 - x;
} else {
tmp = (x * y) + (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 <= (-1.4d0)) then
tmp = y * (x - 0.5d0)
else if (y <= 1.0d0) then
tmp = 0.918938533204673d0 - x
else
tmp = (x * y) + (y * (-0.5d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.4) {
tmp = y * (x - 0.5);
} else if (y <= 1.0) {
tmp = 0.918938533204673 - x;
} else {
tmp = (x * y) + (y * -0.5);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.4: tmp = y * (x - 0.5) elif y <= 1.0: tmp = 0.918938533204673 - x else: tmp = (x * y) + (y * -0.5) return tmp
function code(x, y) tmp = 0.0 if (y <= -1.4) tmp = Float64(y * Float64(x - 0.5)); elseif (y <= 1.0) tmp = Float64(0.918938533204673 - x); else tmp = Float64(Float64(x * y) + Float64(y * -0.5)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.4) tmp = y * (x - 0.5); elseif (y <= 1.0) tmp = 0.918938533204673 - x; else tmp = (x * y) + (y * -0.5); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.4], N[(y * N[(x - 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.0], N[(0.918938533204673 - x), $MachinePrecision], N[(N[(x * y), $MachinePrecision] + N[(y * -0.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.4:\\
\;\;\;\;y \cdot \left(x - 0.5\right)\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;0.918938533204673 - x\\
\mathbf{else}:\\
\;\;\;\;x \cdot y + y \cdot -0.5\\
\end{array}
\end{array}
if y < -1.3999999999999999Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 98.6%
if -1.3999999999999999 < y < 1Initial 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 97.6%
if 1 < 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%
sub-neg97.0%
distribute-lft-in97.1%
metadata-eval97.1%
Applied egg-rr97.1%
Final simplification97.7%
(FPCore (x y) :precision binary64 (if (or (<= y -1.45) (not (<= y 1.8))) (* y (- x 0.5)) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -1.45) || !(y <= 1.8)) {
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.45d0)) .or. (.not. (y <= 1.8d0))) 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.45) || !(y <= 1.8)) {
tmp = y * (x - 0.5);
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.45) or not (y <= 1.8): tmp = y * (x - 0.5) else: tmp = 0.918938533204673 - x return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.45) || !(y <= 1.8)) 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.45) || ~((y <= 1.8))) tmp = y * (x - 0.5); else tmp = 0.918938533204673 - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.45], N[Not[LessEqual[y, 1.8]], $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.45 \lor \neg \left(y \leq 1.8\right):\\
\;\;\;\;y \cdot \left(x - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\
\end{array}
\end{array}
if y < -1.44999999999999996 or 1.80000000000000004 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 97.8%
if -1.44999999999999996 < y < 1.80000000000000004Initial 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 97.6%
Final simplification97.7%
(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%
+-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-udef100.0%
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (x y) :precision binary64 (if (or (<= y -1.85) (not (<= y 1.85))) (* y -0.5) 0.918938533204673))
double code(double x, double y) {
double tmp;
if ((y <= -1.85) || !(y <= 1.85)) {
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 <= (-1.85d0)) .or. (.not. (y <= 1.85d0))) 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 <= -1.85) || !(y <= 1.85)) {
tmp = y * -0.5;
} else {
tmp = 0.918938533204673;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.85) or not (y <= 1.85): tmp = y * -0.5 else: tmp = 0.918938533204673 return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.85) || !(y <= 1.85)) tmp = Float64(y * -0.5); else tmp = 0.918938533204673; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1.85) || ~((y <= 1.85))) tmp = y * -0.5; else tmp = 0.918938533204673; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.85], N[Not[LessEqual[y, 1.85]], $MachinePrecision]], N[(y * -0.5), $MachinePrecision], 0.918938533204673]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.85 \lor \neg \left(y \leq 1.85\right):\\
\;\;\;\;y \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673\\
\end{array}
\end{array}
if y < -1.8500000000000001 or 1.8500000000000001 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 97.8%
Taylor expanded in x around 0 48.0%
*-commutative48.0%
Simplified48.0%
if -1.8500000000000001 < 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 x around 0 62.3%
*-commutative62.3%
Simplified62.3%
Taylor expanded in y around 0 60.5%
Final simplification54.4%
(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 56.0%
*-commutative56.0%
Simplified56.0%
Taylor expanded in y around 0 32.5%
Final simplification32.5%
herbie shell --seed 2023333
(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))