
(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 -1.45e+266)
(* x y)
(if (<= y -1.4e+246)
(* y -0.5)
(if (<= y -3.2e-5)
(* x y)
(if (<= y -1.16e-293)
(- x)
(if (<= y 1.0) 0.918938533204673 (* x y)))))))
double code(double x, double y) {
double tmp;
if (y <= -1.45e+266) {
tmp = x * y;
} else if (y <= -1.4e+246) {
tmp = y * -0.5;
} else if (y <= -3.2e-5) {
tmp = x * y;
} else if (y <= -1.16e-293) {
tmp = -x;
} else if (y <= 1.0) {
tmp = 0.918938533204673;
} 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 <= (-1.45d+266)) then
tmp = x * y
else if (y <= (-1.4d+246)) then
tmp = y * (-0.5d0)
else if (y <= (-3.2d-5)) then
tmp = x * y
else if (y <= (-1.16d-293)) then
tmp = -x
else if (y <= 1.0d0) then
tmp = 0.918938533204673d0
else
tmp = x * y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.45e+266) {
tmp = x * y;
} else if (y <= -1.4e+246) {
tmp = y * -0.5;
} else if (y <= -3.2e-5) {
tmp = x * y;
} else if (y <= -1.16e-293) {
tmp = -x;
} else if (y <= 1.0) {
tmp = 0.918938533204673;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.45e+266: tmp = x * y elif y <= -1.4e+246: tmp = y * -0.5 elif y <= -3.2e-5: tmp = x * y elif y <= -1.16e-293: tmp = -x elif y <= 1.0: tmp = 0.918938533204673 else: tmp = x * y return tmp
function code(x, y) tmp = 0.0 if (y <= -1.45e+266) tmp = Float64(x * y); elseif (y <= -1.4e+246) tmp = Float64(y * -0.5); elseif (y <= -3.2e-5) tmp = Float64(x * y); elseif (y <= -1.16e-293) tmp = Float64(-x); elseif (y <= 1.0) tmp = 0.918938533204673; else tmp = Float64(x * y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.45e+266) tmp = x * y; elseif (y <= -1.4e+246) tmp = y * -0.5; elseif (y <= -3.2e-5) tmp = x * y; elseif (y <= -1.16e-293) tmp = -x; elseif (y <= 1.0) tmp = 0.918938533204673; else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.45e+266], N[(x * y), $MachinePrecision], If[LessEqual[y, -1.4e+246], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, -3.2e-5], N[(x * y), $MachinePrecision], If[LessEqual[y, -1.16e-293], (-x), If[LessEqual[y, 1.0], 0.918938533204673, N[(x * y), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.45 \cdot 10^{+266}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;y \leq -1.4 \cdot 10^{+246}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq -3.2 \cdot 10^{-5}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;y \leq -1.16 \cdot 10^{-293}:\\
\;\;\;\;-x\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;0.918938533204673\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if y < -1.45000000000000009e266 or -1.39999999999999994e246 < y < -3.19999999999999986e-5 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.4%
Taylor expanded in x around inf 56.5%
*-commutative56.5%
Simplified56.5%
if -1.45000000000000009e266 < y < -1.39999999999999994e246Initial 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 86.8%
*-commutative86.8%
Simplified86.8%
if -3.19999999999999986e-5 < y < -1.16e-293Initial 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%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
mul-1-neg100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 67.6%
Taylor expanded in y around 0 67.6%
mul-1-neg67.6%
Simplified67.6%
if -1.16e-293 < 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%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 98.5%
mul-1-neg98.5%
unsub-neg98.5%
Simplified98.5%
Taylor expanded in x around 0 60.4%
Final simplification61.1%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* x (+ y -1.0))))
(if (<= x -5.7e-24)
t_0
(if (<= x -1.1e-194)
0.918938533204673
(if (<= x 4.8e-228)
(* y -0.5)
(if (<= x 450.0) (- 0.918938533204673 x) t_0))))))
double code(double x, double y) {
double t_0 = x * (y + -1.0);
double tmp;
if (x <= -5.7e-24) {
tmp = t_0;
} else if (x <= -1.1e-194) {
tmp = 0.918938533204673;
} else if (x <= 4.8e-228) {
tmp = y * -0.5;
} else if (x <= 450.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 <= (-5.7d-24)) then
tmp = t_0
else if (x <= (-1.1d-194)) then
tmp = 0.918938533204673d0
else if (x <= 4.8d-228) then
tmp = y * (-0.5d0)
else if (x <= 450.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 <= -5.7e-24) {
tmp = t_0;
} else if (x <= -1.1e-194) {
tmp = 0.918938533204673;
} else if (x <= 4.8e-228) {
tmp = y * -0.5;
} else if (x <= 450.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 <= -5.7e-24: tmp = t_0 elif x <= -1.1e-194: tmp = 0.918938533204673 elif x <= 4.8e-228: tmp = y * -0.5 elif x <= 450.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 <= -5.7e-24) tmp = t_0; elseif (x <= -1.1e-194) tmp = 0.918938533204673; elseif (x <= 4.8e-228) tmp = Float64(y * -0.5); elseif (x <= 450.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 <= -5.7e-24) tmp = t_0; elseif (x <= -1.1e-194) tmp = 0.918938533204673; elseif (x <= 4.8e-228) tmp = y * -0.5; elseif (x <= 450.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, -5.7e-24], t$95$0, If[LessEqual[x, -1.1e-194], 0.918938533204673, If[LessEqual[x, 4.8e-228], N[(y * -0.5), $MachinePrecision], If[LessEqual[x, 450.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 -5.7 \cdot 10^{-24}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -1.1 \cdot 10^{-194}:\\
\;\;\;\;0.918938533204673\\
\mathbf{elif}\;x \leq 4.8 \cdot 10^{-228}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;x \leq 450:\\
\;\;\;\;0.918938533204673 - x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -5.70000000000000002e-24 or 450 < x 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%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 97.1%
mul-1-neg97.1%
unsub-neg97.1%
Simplified97.1%
Taylor expanded in x around inf 97.0%
if -5.70000000000000002e-24 < x < -1.1000000000000001e-194Initial 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%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 62.5%
mul-1-neg62.5%
unsub-neg62.5%
Simplified62.5%
Taylor expanded in x around 0 61.5%
if -1.1000000000000001e-194 < x < 4.80000000000000004e-228Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 59.9%
Taylor expanded in x around 0 59.9%
*-commutative59.9%
Simplified59.9%
if 4.80000000000000004e-228 < x < 450Initial 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%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 57.0%
Final simplification80.0%
(FPCore (x y)
:precision binary64
(if (<= y -5.3e+268)
(* x y)
(if (<= y -1.85e+244)
(* y -0.5)
(if (or (<= y -225.0) (not (<= y 1.0)))
(* x y)
(- 0.918938533204673 x)))))
double code(double x, double y) {
double tmp;
if (y <= -5.3e+268) {
tmp = x * y;
} else if (y <= -1.85e+244) {
tmp = y * -0.5;
} else if ((y <= -225.0) || !(y <= 1.0)) {
tmp = x * y;
} 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 <= (-5.3d+268)) then
tmp = x * y
else if (y <= (-1.85d+244)) then
tmp = y * (-0.5d0)
else if ((y <= (-225.0d0)) .or. (.not. (y <= 1.0d0))) then
tmp = x * y
else
tmp = 0.918938533204673d0 - x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -5.3e+268) {
tmp = x * y;
} else if (y <= -1.85e+244) {
tmp = y * -0.5;
} else if ((y <= -225.0) || !(y <= 1.0)) {
tmp = x * y;
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -5.3e+268: tmp = x * y elif y <= -1.85e+244: tmp = y * -0.5 elif (y <= -225.0) or not (y <= 1.0): tmp = x * y else: tmp = 0.918938533204673 - x return tmp
function code(x, y) tmp = 0.0 if (y <= -5.3e+268) tmp = Float64(x * y); elseif (y <= -1.85e+244) tmp = Float64(y * -0.5); elseif ((y <= -225.0) || !(y <= 1.0)) tmp = Float64(x * y); else tmp = Float64(0.918938533204673 - x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -5.3e+268) tmp = x * y; elseif (y <= -1.85e+244) tmp = y * -0.5; elseif ((y <= -225.0) || ~((y <= 1.0))) tmp = x * y; else tmp = 0.918938533204673 - x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -5.3e+268], N[(x * y), $MachinePrecision], If[LessEqual[y, -1.85e+244], N[(y * -0.5), $MachinePrecision], If[Or[LessEqual[y, -225.0], N[Not[LessEqual[y, 1.0]], $MachinePrecision]], N[(x * y), $MachinePrecision], N[(0.918938533204673 - x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.3 \cdot 10^{+268}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;y \leq -1.85 \cdot 10^{+244}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq -225 \lor \neg \left(y \leq 1\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\
\end{array}
\end{array}
if y < -5.30000000000000004e268 or -1.8500000000000001e244 < y < -225 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 98.7%
Taylor expanded in x around inf 57.4%
*-commutative57.4%
Simplified57.4%
if -5.30000000000000004e268 < y < -1.8500000000000001e244Initial 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 86.8%
*-commutative86.8%
Simplified86.8%
if -225 < 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%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 98.2%
Final simplification78.8%
(FPCore (x y)
:precision binary64
(if (<= y -3.2e-5)
(* y -0.5)
(if (<= y -5.4e-308)
(- x)
(if (<= y 4400000000000.0) 0.918938533204673 (* y -0.5)))))
double code(double x, double y) {
double tmp;
if (y <= -3.2e-5) {
tmp = y * -0.5;
} else if (y <= -5.4e-308) {
tmp = -x;
} else if (y <= 4400000000000.0) {
tmp = 0.918938533204673;
} else {
tmp = y * -0.5;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-3.2d-5)) then
tmp = y * (-0.5d0)
else if (y <= (-5.4d-308)) then
tmp = -x
else if (y <= 4400000000000.0d0) then
tmp = 0.918938533204673d0
else
tmp = y * (-0.5d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -3.2e-5) {
tmp = y * -0.5;
} else if (y <= -5.4e-308) {
tmp = -x;
} else if (y <= 4400000000000.0) {
tmp = 0.918938533204673;
} else {
tmp = y * -0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -3.2e-5: tmp = y * -0.5 elif y <= -5.4e-308: tmp = -x elif y <= 4400000000000.0: tmp = 0.918938533204673 else: tmp = y * -0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= -3.2e-5) tmp = Float64(y * -0.5); elseif (y <= -5.4e-308) tmp = Float64(-x); elseif (y <= 4400000000000.0) tmp = 0.918938533204673; else tmp = Float64(y * -0.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -3.2e-5) tmp = y * -0.5; elseif (y <= -5.4e-308) tmp = -x; elseif (y <= 4400000000000.0) tmp = 0.918938533204673; else tmp = y * -0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -3.2e-5], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, -5.4e-308], (-x), If[LessEqual[y, 4400000000000.0], 0.918938533204673, N[(y * -0.5), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.2 \cdot 10^{-5}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq -5.4 \cdot 10^{-308}:\\
\;\;\;\;-x\\
\mathbf{elif}\;y \leq 4400000000000:\\
\;\;\;\;0.918938533204673\\
\mathbf{else}:\\
\;\;\;\;y \cdot -0.5\\
\end{array}
\end{array}
if y < -3.19999999999999986e-5 or 4.4e12 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 97.6%
Taylor expanded in x around 0 44.5%
*-commutative44.5%
Simplified44.5%
if -3.19999999999999986e-5 < y < -5.4000000000000003e-308Initial 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%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
mul-1-neg100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 67.6%
Taylor expanded in y around 0 67.6%
mul-1-neg67.6%
Simplified67.6%
if -5.4000000000000003e-308 < y < 4.4e12Initial 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%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 98.6%
mul-1-neg98.6%
unsub-neg98.6%
Simplified98.6%
Taylor expanded in x around 0 59.6%
Final simplification54.0%
(FPCore (x y) :precision binary64 (if (or (<= y -33000000000.0) (not (<= y 4400000000000.0))) (* y (- x 0.5)) (+ (* x (+ y -1.0)) 0.918938533204673)))
double code(double x, double y) {
double tmp;
if ((y <= -33000000000.0) || !(y <= 4400000000000.0)) {
tmp = y * (x - 0.5);
} else {
tmp = (x * (y + -1.0)) + 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 <= (-33000000000.0d0)) .or. (.not. (y <= 4400000000000.0d0))) then
tmp = y * (x - 0.5d0)
else
tmp = (x * (y + (-1.0d0))) + 0.918938533204673d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -33000000000.0) || !(y <= 4400000000000.0)) {
tmp = y * (x - 0.5);
} else {
tmp = (x * (y + -1.0)) + 0.918938533204673;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -33000000000.0) or not (y <= 4400000000000.0): tmp = y * (x - 0.5) else: tmp = (x * (y + -1.0)) + 0.918938533204673 return tmp
function code(x, y) tmp = 0.0 if ((y <= -33000000000.0) || !(y <= 4400000000000.0)) tmp = Float64(y * Float64(x - 0.5)); else tmp = Float64(Float64(x * Float64(y + -1.0)) + 0.918938533204673); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -33000000000.0) || ~((y <= 4400000000000.0))) tmp = y * (x - 0.5); else tmp = (x * (y + -1.0)) + 0.918938533204673; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -33000000000.0], N[Not[LessEqual[y, 4400000000000.0]], $MachinePrecision]], N[(y * N[(x - 0.5), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision] + 0.918938533204673), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -33000000000 \lor \neg \left(y \leq 4400000000000\right):\\
\;\;\;\;y \cdot \left(x - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y + -1\right) + 0.918938533204673\\
\end{array}
\end{array}
if y < -3.3e10 or 4.4e12 < 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%
if -3.3e10 < y < 4.4e12Initial 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%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 98.2%
mul-1-neg98.2%
unsub-neg98.2%
Simplified98.2%
Final simplification99.0%
(FPCore (x y) :precision binary64 (if (or (<= y -1.35) (not (<= y 1.15))) (* y (- x 0.5)) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -1.35) || !(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.35d0)) .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.35) || !(y <= 1.15)) {
tmp = y * (x - 0.5);
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.35) 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.35) || !(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.35) || ~((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.35], 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.35 \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.3500000000000001 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.2%
if -1.3500000000000001 < y < 1.1499999999999999Initial 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%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 98.8%
Final simplification98.5%
(FPCore (x y) :precision binary64 (if (or (<= x -0.28) (not (<= x 0.92))) (- x) 0.918938533204673))
double code(double x, double y) {
double tmp;
if ((x <= -0.28) || !(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.28d0)) .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.28) || !(x <= 0.92)) {
tmp = -x;
} else {
tmp = 0.918938533204673;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -0.28) or not (x <= 0.92): tmp = -x else: tmp = 0.918938533204673 return tmp
function code(x, y) tmp = 0.0 if ((x <= -0.28) || !(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.28) || ~((x <= 0.92))) tmp = -x; else tmp = 0.918938533204673; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -0.28], N[Not[LessEqual[x, 0.92]], $MachinePrecision]], (-x), 0.918938533204673]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.28 \lor \neg \left(x \leq 0.92\right):\\
\;\;\;\;-x\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673\\
\end{array}
\end{array}
if x < -0.28000000000000003 or 0.92000000000000004 < x 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%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 97.8%
mul-1-neg97.8%
unsub-neg97.8%
Simplified97.8%
Taylor expanded in x around inf 97.1%
Taylor expanded in y around 0 49.1%
mul-1-neg49.1%
Simplified49.1%
if -0.28000000000000003 < x < 0.92000000000000004Initial 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%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 52.9%
mul-1-neg52.9%
unsub-neg52.9%
Simplified52.9%
Taylor expanded in x around 0 52.1%
Final simplification50.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%
+-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%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
fma-undefine100.0%
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (x y) :precision binary64 0.918938533204673)
double code(double x, double y) {
return 0.918938533204673;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 0.918938533204673d0
end function
public static double code(double x, double y) {
return 0.918938533204673;
}
def code(x, y): return 0.918938533204673
function code(x, y) return 0.918938533204673 end
function tmp = code(x, y) tmp = 0.918938533204673; end
code[x_, y_] := 0.918938533204673
\begin{array}{l}
\\
0.918938533204673
\end{array}
Initial program 100.0%
+-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%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 77.4%
mul-1-neg77.4%
unsub-neg77.4%
Simplified77.4%
Taylor expanded in x around 0 25.1%
Final simplification25.1%
herbie shell --seed 2024115
(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))