
(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 (+ (- (* 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 -9.5e-13)
(* y -0.5)
(if (<= y -4.7e-157)
(- x)
(if (<= y 27000.0)
0.918938533204673
(if (<= y 6.5e+108) (* y -0.5) (* x y))))))
double code(double x, double y) {
double tmp;
if (y <= -9.5e-13) {
tmp = y * -0.5;
} else if (y <= -4.7e-157) {
tmp = -x;
} else if (y <= 27000.0) {
tmp = 0.918938533204673;
} else if (y <= 6.5e+108) {
tmp = y * -0.5;
} else {
tmp = x * y;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-9.5d-13)) then
tmp = y * (-0.5d0)
else if (y <= (-4.7d-157)) then
tmp = -x
else if (y <= 27000.0d0) then
tmp = 0.918938533204673d0
else if (y <= 6.5d+108) then
tmp = y * (-0.5d0)
else
tmp = x * y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -9.5e-13) {
tmp = y * -0.5;
} else if (y <= -4.7e-157) {
tmp = -x;
} else if (y <= 27000.0) {
tmp = 0.918938533204673;
} else if (y <= 6.5e+108) {
tmp = y * -0.5;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -9.5e-13: tmp = y * -0.5 elif y <= -4.7e-157: tmp = -x elif y <= 27000.0: tmp = 0.918938533204673 elif y <= 6.5e+108: tmp = y * -0.5 else: tmp = x * y return tmp
function code(x, y) tmp = 0.0 if (y <= -9.5e-13) tmp = Float64(y * -0.5); elseif (y <= -4.7e-157) tmp = Float64(-x); elseif (y <= 27000.0) tmp = 0.918938533204673; elseif (y <= 6.5e+108) tmp = Float64(y * -0.5); else tmp = Float64(x * y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -9.5e-13) tmp = y * -0.5; elseif (y <= -4.7e-157) tmp = -x; elseif (y <= 27000.0) tmp = 0.918938533204673; elseif (y <= 6.5e+108) tmp = y * -0.5; else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -9.5e-13], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, -4.7e-157], (-x), If[LessEqual[y, 27000.0], 0.918938533204673, If[LessEqual[y, 6.5e+108], N[(y * -0.5), $MachinePrecision], N[(x * y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.5 \cdot 10^{-13}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq -4.7 \cdot 10^{-157}:\\
\;\;\;\;-x\\
\mathbf{elif}\;y \leq 27000:\\
\;\;\;\;0.918938533204673\\
\mathbf{elif}\;y \leq 6.5 \cdot 10^{+108}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if y < -9.49999999999999991e-13 or 27000 < y < 6.4999999999999996e108Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 98.8%
Taylor expanded in y around inf 94.9%
*-commutative94.9%
Simplified94.9%
Taylor expanded in x around 0 62.8%
*-commutative62.8%
Simplified62.8%
if -9.49999999999999991e-13 < y < -4.7000000000000002e-157Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
sub-neg100.0%
distribute-lft-out--100.0%
cancel-sign-sub-inv100.0%
*-rgt-identity100.0%
+-commutative100.0%
associate-+r+100.0%
neg-mul-1100.0%
associate-+r+100.0%
distribute-lft-neg-in100.0%
cancel-sign-sub-inv100.0%
distribute-rgt-out--100.0%
neg-mul-1100.0%
associate-+r+100.0%
+-commutative100.0%
unsub-neg100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
Taylor expanded in x around inf 63.1%
Taylor expanded in y around 0 63.1%
mul-1-neg63.1%
Simplified63.1%
if -4.7000000000000002e-157 < y < 27000Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 99.0%
neg-mul-199.0%
unsub-neg99.0%
Simplified99.0%
Taylor expanded in x around 0 58.3%
if 6.4999999999999996e108 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
sub-neg100.0%
distribute-lft-out--100.0%
cancel-sign-sub-inv100.0%
*-rgt-identity100.0%
+-commutative100.0%
associate-+r+100.0%
neg-mul-1100.0%
associate-+r+100.0%
distribute-lft-neg-in100.0%
cancel-sign-sub-inv100.0%
distribute-rgt-out--100.0%
neg-mul-1100.0%
associate-+r+100.0%
+-commutative100.0%
unsub-neg100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 66.3%
Taylor expanded in x around inf 66.7%
Taylor expanded in y around inf 66.7%
(FPCore (x y)
:precision binary64
(if (<= y -26.0)
(* y -0.5)
(if (<= y 1.85)
(- 0.918938533204673 x)
(if (<= y 4.5e+110) (* y -0.5) (* x y)))))
double code(double x, double y) {
double tmp;
if (y <= -26.0) {
tmp = y * -0.5;
} else if (y <= 1.85) {
tmp = 0.918938533204673 - x;
} else if (y <= 4.5e+110) {
tmp = y * -0.5;
} else {
tmp = x * y;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-26.0d0)) then
tmp = y * (-0.5d0)
else if (y <= 1.85d0) then
tmp = 0.918938533204673d0 - x
else if (y <= 4.5d+110) then
tmp = y * (-0.5d0)
else
tmp = x * y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -26.0) {
tmp = y * -0.5;
} else if (y <= 1.85) {
tmp = 0.918938533204673 - x;
} else if (y <= 4.5e+110) {
tmp = y * -0.5;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -26.0: tmp = y * -0.5 elif y <= 1.85: tmp = 0.918938533204673 - x elif y <= 4.5e+110: tmp = y * -0.5 else: tmp = x * y return tmp
function code(x, y) tmp = 0.0 if (y <= -26.0) tmp = Float64(y * -0.5); elseif (y <= 1.85) tmp = Float64(0.918938533204673 - x); elseif (y <= 4.5e+110) tmp = Float64(y * -0.5); else tmp = Float64(x * y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -26.0) tmp = y * -0.5; elseif (y <= 1.85) tmp = 0.918938533204673 - x; elseif (y <= 4.5e+110) tmp = y * -0.5; else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -26.0], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 1.85], N[(0.918938533204673 - x), $MachinePrecision], If[LessEqual[y, 4.5e+110], N[(y * -0.5), $MachinePrecision], N[(x * y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -26:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 1.85:\\
\;\;\;\;0.918938533204673 - x\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{+110}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if y < -26 or 1.8500000000000001 < y < 4.5000000000000003e110Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 98.1%
Taylor expanded in y around inf 96.3%
*-commutative96.3%
Simplified96.3%
Taylor expanded in x around 0 63.3%
*-commutative63.3%
Simplified63.3%
if -26 < y < 1.8500000000000001Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 99.3%
neg-mul-199.3%
unsub-neg99.3%
Simplified99.3%
if 4.5000000000000003e110 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
sub-neg100.0%
distribute-lft-out--100.0%
cancel-sign-sub-inv100.0%
*-rgt-identity100.0%
+-commutative100.0%
associate-+r+100.0%
neg-mul-1100.0%
associate-+r+100.0%
distribute-lft-neg-in100.0%
cancel-sign-sub-inv100.0%
distribute-rgt-out--100.0%
neg-mul-1100.0%
associate-+r+100.0%
+-commutative100.0%
unsub-neg100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 66.3%
Taylor expanded in x around inf 66.7%
Taylor expanded in y around inf 66.7%
(FPCore (x y) :precision binary64 (if (<= x -0.92) (- x) (if (<= x 0.92) 0.918938533204673 (if (<= x 9.5e+114) (* x y) (- x)))))
double code(double x, double y) {
double tmp;
if (x <= -0.92) {
tmp = -x;
} else if (x <= 0.92) {
tmp = 0.918938533204673;
} else if (x <= 9.5e+114) {
tmp = x * y;
} 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 <= (-0.92d0)) then
tmp = -x
else if (x <= 0.92d0) then
tmp = 0.918938533204673d0
else if (x <= 9.5d+114) then
tmp = x * y
else
tmp = -x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -0.92) {
tmp = -x;
} else if (x <= 0.92) {
tmp = 0.918938533204673;
} else if (x <= 9.5e+114) {
tmp = x * y;
} else {
tmp = -x;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -0.92: tmp = -x elif x <= 0.92: tmp = 0.918938533204673 elif x <= 9.5e+114: tmp = x * y else: tmp = -x return tmp
function code(x, y) tmp = 0.0 if (x <= -0.92) tmp = Float64(-x); elseif (x <= 0.92) tmp = 0.918938533204673; elseif (x <= 9.5e+114) tmp = Float64(x * y); else tmp = Float64(-x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -0.92) tmp = -x; elseif (x <= 0.92) tmp = 0.918938533204673; elseif (x <= 9.5e+114) tmp = x * y; else tmp = -x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -0.92], (-x), If[LessEqual[x, 0.92], 0.918938533204673, If[LessEqual[x, 9.5e+114], N[(x * y), $MachinePrecision], (-x)]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.92:\\
\;\;\;\;-x\\
\mathbf{elif}\;x \leq 0.92:\\
\;\;\;\;0.918938533204673\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{+114}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
\end{array}
if x < -0.92000000000000004 or 9.5000000000000001e114 < x Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
sub-neg100.0%
distribute-lft-out--100.0%
cancel-sign-sub-inv100.0%
*-rgt-identity100.0%
+-commutative100.0%
associate-+r+100.0%
neg-mul-1100.0%
associate-+r+100.0%
distribute-lft-neg-in100.0%
cancel-sign-sub-inv100.0%
distribute-rgt-out--100.0%
neg-mul-1100.0%
associate-+r+100.0%
+-commutative100.0%
unsub-neg100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
Taylor expanded in x around inf 99.9%
Taylor expanded in y around 0 60.1%
mul-1-neg60.1%
Simplified60.1%
if -0.92000000000000004 < x < 0.92000000000000004Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 53.2%
neg-mul-153.2%
unsub-neg53.2%
Simplified53.2%
Taylor expanded in x around 0 53.0%
if 0.92000000000000004 < x < 9.5000000000000001e114Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
sub-neg100.0%
distribute-lft-out--99.9%
cancel-sign-sub-inv99.9%
*-rgt-identity99.9%
+-commutative99.9%
associate-+r+99.9%
neg-mul-199.9%
associate-+r+99.9%
distribute-lft-neg-in99.9%
cancel-sign-sub-inv99.9%
distribute-rgt-out--99.9%
neg-mul-199.9%
associate-+r+99.9%
+-commutative99.9%
unsub-neg99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around inf 97.8%
Taylor expanded in x around inf 97.8%
Taylor expanded in y around inf 64.2%
(FPCore (x y) :precision binary64 (if (or (<= x -0.7) (not (<= x 0.5))) (* x (+ y -1.0)) (- 0.918938533204673 (* y 0.5))))
double code(double x, double y) {
double tmp;
if ((x <= -0.7) || !(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.7d0)) .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.7) || !(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.7) 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.7) || !(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.7) || ~((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.7], 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.7 \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.69999999999999996 or 0.5 < x Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
sub-neg100.0%
distribute-lft-out--100.0%
cancel-sign-sub-inv100.0%
*-rgt-identity100.0%
+-commutative100.0%
associate-+r+100.0%
neg-mul-1100.0%
associate-+r+100.0%
distribute-lft-neg-in100.0%
cancel-sign-sub-inv100.0%
distribute-rgt-out--100.0%
neg-mul-1100.0%
associate-+r+100.0%
+-commutative100.0%
unsub-neg100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 99.7%
Taylor expanded in x around inf 99.6%
if -0.69999999999999996 < x < 0.5Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 99.1%
*-commutative99.1%
Simplified99.1%
Final simplification99.3%
(FPCore (x y) :precision binary64 (if (or (<= y -1.55) (not (<= y 1.0))) (* y (- x 0.5)) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -1.55) || !(y <= 1.0)) {
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.55d0)) .or. (.not. (y <= 1.0d0))) 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.55) || !(y <= 1.0)) {
tmp = y * (x - 0.5);
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.55) or not (y <= 1.0): tmp = y * (x - 0.5) else: tmp = 0.918938533204673 - x return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.55) || !(y <= 1.0)) 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.55) || ~((y <= 1.0))) tmp = y * (x - 0.5); else tmp = 0.918938533204673 - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.55], N[Not[LessEqual[y, 1.0]], $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.55 \lor \neg \left(y \leq 1\right):\\
\;\;\;\;y \cdot \left(x - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\
\end{array}
\end{array}
if y < -1.55000000000000004 or 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.3%
if -1.55000000000000004 < y < 1Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 99.3%
neg-mul-199.3%
unsub-neg99.3%
Simplified99.3%
Final simplification98.4%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* x (+ y -1.0))))
(if (<= x -1.28e-8)
(+ t_0 0.918938533204673)
(if (<= x 0.68) (- 0.918938533204673 (* y 0.5)) t_0))))
double code(double x, double y) {
double t_0 = x * (y + -1.0);
double tmp;
if (x <= -1.28e-8) {
tmp = t_0 + 0.918938533204673;
} else if (x <= 0.68) {
tmp = 0.918938533204673 - (y * 0.5);
} 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 <= (-1.28d-8)) then
tmp = t_0 + 0.918938533204673d0
else if (x <= 0.68d0) then
tmp = 0.918938533204673d0 - (y * 0.5d0)
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 <= -1.28e-8) {
tmp = t_0 + 0.918938533204673;
} else if (x <= 0.68) {
tmp = 0.918938533204673 - (y * 0.5);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = x * (y + -1.0) tmp = 0 if x <= -1.28e-8: tmp = t_0 + 0.918938533204673 elif x <= 0.68: tmp = 0.918938533204673 - (y * 0.5) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(x * Float64(y + -1.0)) tmp = 0.0 if (x <= -1.28e-8) tmp = Float64(t_0 + 0.918938533204673); elseif (x <= 0.68) tmp = Float64(0.918938533204673 - Float64(y * 0.5)); 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 <= -1.28e-8) tmp = t_0 + 0.918938533204673; elseif (x <= 0.68) tmp = 0.918938533204673 - (y * 0.5); 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, -1.28e-8], N[(t$95$0 + 0.918938533204673), $MachinePrecision], If[LessEqual[x, 0.68], N[(0.918938533204673 - N[(y * 0.5), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(y + -1\right)\\
\mathbf{if}\;x \leq -1.28 \cdot 10^{-8}:\\
\;\;\;\;t\_0 + 0.918938533204673\\
\mathbf{elif}\;x \leq 0.68:\\
\;\;\;\;0.918938533204673 - y \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1.28000000000000005e-8Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
sub-neg100.0%
distribute-lft-out--100.0%
cancel-sign-sub-inv100.0%
*-rgt-identity100.0%
+-commutative100.0%
associate-+r+100.0%
neg-mul-1100.0%
associate-+r+100.0%
distribute-lft-neg-in100.0%
cancel-sign-sub-inv100.0%
distribute-rgt-out--100.0%
neg-mul-1100.0%
associate-+r+100.0%
+-commutative100.0%
unsub-neg100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
if -1.28000000000000005e-8 < x < 0.680000000000000049Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 99.1%
*-commutative99.1%
Simplified99.1%
if 0.680000000000000049 < x Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
sub-neg100.0%
distribute-lft-out--99.9%
cancel-sign-sub-inv99.9%
*-rgt-identity99.9%
+-commutative99.9%
associate-+r+99.9%
neg-mul-199.9%
associate-+r+99.9%
distribute-lft-neg-in99.9%
cancel-sign-sub-inv99.9%
distribute-rgt-out--99.9%
neg-mul-199.9%
associate-+r+99.9%
+-commutative99.9%
unsub-neg99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around inf 99.3%
Taylor expanded in x around inf 99.3%
Final simplification99.3%
(FPCore (x y) :precision binary64 (if (or (<= x -0.92) (not (<= x 0.92))) (- x) 0.918938533204673))
double code(double x, double y) {
double tmp;
if ((x <= -0.92) || !(x <= 0.92)) {
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 <= 0.92d0))) 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 <= 0.92)) {
tmp = -x;
} else {
tmp = 0.918938533204673;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -0.92) or not (x <= 0.92): tmp = -x else: tmp = 0.918938533204673 return tmp
function code(x, y) tmp = 0.0 if ((x <= -0.92) || !(x <= 0.92)) 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 <= 0.92))) tmp = -x; else tmp = 0.918938533204673; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -0.92], N[Not[LessEqual[x, 0.92]], $MachinePrecision]], (-x), 0.918938533204673]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.92 \lor \neg \left(x \leq 0.92\right):\\
\;\;\;\;-x\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673\\
\end{array}
\end{array}
if x < -0.92000000000000004 or 0.92000000000000004 < x Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
sub-neg100.0%
distribute-lft-out--100.0%
cancel-sign-sub-inv100.0%
*-rgt-identity100.0%
+-commutative100.0%
associate-+r+100.0%
neg-mul-1100.0%
associate-+r+100.0%
distribute-lft-neg-in100.0%
cancel-sign-sub-inv100.0%
distribute-rgt-out--100.0%
neg-mul-1100.0%
associate-+r+100.0%
+-commutative100.0%
unsub-neg100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 99.7%
Taylor expanded in x around inf 99.6%
Taylor expanded in y around 0 56.3%
mul-1-neg56.3%
Simplified56.3%
if -0.92000000000000004 < x < 0.92000000000000004Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 53.2%
neg-mul-153.2%
unsub-neg53.2%
Simplified53.2%
Taylor expanded in x around 0 53.0%
Final simplification54.5%
(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%
sub-neg100.0%
distribute-lft-out--100.0%
cancel-sign-sub-inv100.0%
*-rgt-identity100.0%
+-commutative100.0%
associate-+r+100.0%
neg-mul-1100.0%
associate-+r+100.0%
distribute-lft-neg-in100.0%
cancel-sign-sub-inv100.0%
distribute-rgt-out--100.0%
neg-mul-1100.0%
associate-+r+100.0%
+-commutative100.0%
unsub-neg100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.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 54.7%
neg-mul-154.7%
unsub-neg54.7%
Simplified54.7%
Taylor expanded in x around 0 30.3%
herbie shell --seed 2024186
(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))