
(FPCore (x y) :precision binary64 (+ (- (* x (- y 1.0)) (* y 0.5)) 0.918938533204673))
double code(double x, double y) {
return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x * (y - 1.0d0)) - (y * 0.5d0)) + 0.918938533204673d0
end function
public static double code(double x, double y) {
return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673;
}
def code(x, y): return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673
function code(x, y) return Float64(Float64(Float64(x * Float64(y - 1.0)) - Float64(y * 0.5)) + 0.918938533204673) end
function tmp = code(x, y) tmp = ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673; end
code[x_, y_] := N[(N[(N[(x * N[(y - 1.0), $MachinePrecision]), $MachinePrecision] - N[(y * 0.5), $MachinePrecision]), $MachinePrecision] + 0.918938533204673), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (+ (- (* x (- y 1.0)) (* y 0.5)) 0.918938533204673))
double code(double x, double y) {
return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x * (y - 1.0d0)) - (y * 0.5d0)) + 0.918938533204673d0
end function
public static double code(double x, double y) {
return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673;
}
def code(x, y): return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673
function code(x, y) return Float64(Float64(Float64(x * Float64(y - 1.0)) - Float64(y * 0.5)) + 0.918938533204673) end
function tmp = code(x, y) tmp = ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673; end
code[x_, y_] := N[(N[(N[(x * N[(y - 1.0), $MachinePrecision]), $MachinePrecision] - N[(y * 0.5), $MachinePrecision]), $MachinePrecision] + 0.918938533204673), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673
\end{array}
(FPCore (x y) :precision binary64 (+ (- (* 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.14e+241)
(* x y)
(if (<= y -2.1e+222)
(* y -0.5)
(if (<= y -2.3e+157)
(* x y)
(if (<= y -2.35e+106)
(* y -0.5)
(if (<= y -7.2)
(* x y)
(if (<= y 1.65)
(- 0.918938533204673 x)
(if (or (<= y 2.05e+25) (not (<= y 7e+176)))
(* x y)
(* y -0.5)))))))))
double code(double x, double y) {
double tmp;
if (y <= -1.14e+241) {
tmp = x * y;
} else if (y <= -2.1e+222) {
tmp = y * -0.5;
} else if (y <= -2.3e+157) {
tmp = x * y;
} else if (y <= -2.35e+106) {
tmp = y * -0.5;
} else if (y <= -7.2) {
tmp = x * y;
} else if (y <= 1.65) {
tmp = 0.918938533204673 - x;
} else if ((y <= 2.05e+25) || !(y <= 7e+176)) {
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 <= (-1.14d+241)) then
tmp = x * y
else if (y <= (-2.1d+222)) then
tmp = y * (-0.5d0)
else if (y <= (-2.3d+157)) then
tmp = x * y
else if (y <= (-2.35d+106)) then
tmp = y * (-0.5d0)
else if (y <= (-7.2d0)) then
tmp = x * y
else if (y <= 1.65d0) then
tmp = 0.918938533204673d0 - x
else if ((y <= 2.05d+25) .or. (.not. (y <= 7d+176))) 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 <= -1.14e+241) {
tmp = x * y;
} else if (y <= -2.1e+222) {
tmp = y * -0.5;
} else if (y <= -2.3e+157) {
tmp = x * y;
} else if (y <= -2.35e+106) {
tmp = y * -0.5;
} else if (y <= -7.2) {
tmp = x * y;
} else if (y <= 1.65) {
tmp = 0.918938533204673 - x;
} else if ((y <= 2.05e+25) || !(y <= 7e+176)) {
tmp = x * y;
} else {
tmp = y * -0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.14e+241: tmp = x * y elif y <= -2.1e+222: tmp = y * -0.5 elif y <= -2.3e+157: tmp = x * y elif y <= -2.35e+106: tmp = y * -0.5 elif y <= -7.2: tmp = x * y elif y <= 1.65: tmp = 0.918938533204673 - x elif (y <= 2.05e+25) or not (y <= 7e+176): tmp = x * y else: tmp = y * -0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= -1.14e+241) tmp = Float64(x * y); elseif (y <= -2.1e+222) tmp = Float64(y * -0.5); elseif (y <= -2.3e+157) tmp = Float64(x * y); elseif (y <= -2.35e+106) tmp = Float64(y * -0.5); elseif (y <= -7.2) tmp = Float64(x * y); elseif (y <= 1.65) tmp = Float64(0.918938533204673 - x); elseif ((y <= 2.05e+25) || !(y <= 7e+176)) 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 <= -1.14e+241) tmp = x * y; elseif (y <= -2.1e+222) tmp = y * -0.5; elseif (y <= -2.3e+157) tmp = x * y; elseif (y <= -2.35e+106) tmp = y * -0.5; elseif (y <= -7.2) tmp = x * y; elseif (y <= 1.65) tmp = 0.918938533204673 - x; elseif ((y <= 2.05e+25) || ~((y <= 7e+176))) tmp = x * y; else tmp = y * -0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.14e+241], N[(x * y), $MachinePrecision], If[LessEqual[y, -2.1e+222], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, -2.3e+157], N[(x * y), $MachinePrecision], If[LessEqual[y, -2.35e+106], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, -7.2], N[(x * y), $MachinePrecision], If[LessEqual[y, 1.65], N[(0.918938533204673 - x), $MachinePrecision], If[Or[LessEqual[y, 2.05e+25], N[Not[LessEqual[y, 7e+176]], $MachinePrecision]], N[(x * y), $MachinePrecision], N[(y * -0.5), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.14 \cdot 10^{+241}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;y \leq -2.1 \cdot 10^{+222}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq -2.3 \cdot 10^{+157}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;y \leq -2.35 \cdot 10^{+106}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq -7.2:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;y \leq 1.65:\\
\;\;\;\;0.918938533204673 - x\\
\mathbf{elif}\;y \leq 2.05 \cdot 10^{+25} \lor \neg \left(y \leq 7 \cdot 10^{+176}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;y \cdot -0.5\\
\end{array}
\end{array}
if y < -1.13999999999999995e241 or -2.1000000000000001e222 < y < -2.30000000000000004e157 or -2.35000000000000012e106 < y < -7.20000000000000018 or 1.6499999999999999 < y < 2.04999999999999983e25 or 7.00000000000000005e176 < y 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-in99.9%
metadata-eval99.9%
neg-mul-199.9%
associate--r+99.9%
distribute-lft-out--99.9%
unsub-neg99.9%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around inf 93.4%
Taylor expanded in x around inf 64.5%
if -1.13999999999999995e241 < y < -2.1000000000000001e222 or -2.30000000000000004e157 < y < -2.35000000000000012e106 or 2.04999999999999983e25 < y < 7.00000000000000005e176Initial 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 inf 100.0%
Taylor expanded in x around 0 70.9%
*-commutative70.9%
Simplified70.9%
if -7.20000000000000018 < y < 1.6499999999999999Initial 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.7%
Final simplification80.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* x (+ y -1.0))))
(if (<= x -1.95e-7)
t_0
(if (<= x -2.25e-184)
(- 0.918938533204673 x)
(if (<= x -8.2e-288)
(* y -0.5)
(if (<= x 1.75e-156)
0.918938533204673
(if (<= x 0.5) (* y -0.5) t_0)))))))
double code(double x, double y) {
double t_0 = x * (y + -1.0);
double tmp;
if (x <= -1.95e-7) {
tmp = t_0;
} else if (x <= -2.25e-184) {
tmp = 0.918938533204673 - x;
} else if (x <= -8.2e-288) {
tmp = y * -0.5;
} else if (x <= 1.75e-156) {
tmp = 0.918938533204673;
} else if (x <= 0.5) {
tmp = 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.95d-7)) then
tmp = t_0
else if (x <= (-2.25d-184)) then
tmp = 0.918938533204673d0 - x
else if (x <= (-8.2d-288)) then
tmp = y * (-0.5d0)
else if (x <= 1.75d-156) then
tmp = 0.918938533204673d0
else if (x <= 0.5d0) then
tmp = 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.95e-7) {
tmp = t_0;
} else if (x <= -2.25e-184) {
tmp = 0.918938533204673 - x;
} else if (x <= -8.2e-288) {
tmp = y * -0.5;
} else if (x <= 1.75e-156) {
tmp = 0.918938533204673;
} else if (x <= 0.5) {
tmp = y * -0.5;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = x * (y + -1.0) tmp = 0 if x <= -1.95e-7: tmp = t_0 elif x <= -2.25e-184: tmp = 0.918938533204673 - x elif x <= -8.2e-288: tmp = y * -0.5 elif x <= 1.75e-156: tmp = 0.918938533204673 elif x <= 0.5: tmp = 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.95e-7) tmp = t_0; elseif (x <= -2.25e-184) tmp = Float64(0.918938533204673 - x); elseif (x <= -8.2e-288) tmp = Float64(y * -0.5); elseif (x <= 1.75e-156) tmp = 0.918938533204673; elseif (x <= 0.5) tmp = 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.95e-7) tmp = t_0; elseif (x <= -2.25e-184) tmp = 0.918938533204673 - x; elseif (x <= -8.2e-288) tmp = y * -0.5; elseif (x <= 1.75e-156) tmp = 0.918938533204673; elseif (x <= 0.5) tmp = 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.95e-7], t$95$0, If[LessEqual[x, -2.25e-184], N[(0.918938533204673 - x), $MachinePrecision], If[LessEqual[x, -8.2e-288], N[(y * -0.5), $MachinePrecision], If[LessEqual[x, 1.75e-156], 0.918938533204673, If[LessEqual[x, 0.5], N[(y * -0.5), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(y + -1\right)\\
\mathbf{if}\;x \leq -1.95 \cdot 10^{-7}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -2.25 \cdot 10^{-184}:\\
\;\;\;\;0.918938533204673 - x\\
\mathbf{elif}\;x \leq -8.2 \cdot 10^{-288}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;x \leq 1.75 \cdot 10^{-156}:\\
\;\;\;\;0.918938533204673\\
\mathbf{elif}\;x \leq 0.5:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x < -1.95000000000000012e-7 or 0.5 < 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-in99.9%
metadata-eval99.9%
neg-mul-199.9%
associate--r+99.9%
distribute-lft-out--99.9%
unsub-neg99.9%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 97.0%
mul-1-neg97.0%
neg-sub097.0%
distribute-rgt-in97.0%
mul-1-neg97.0%
distribute-lft-neg-in97.0%
*-lft-identity97.0%
sub-neg97.0%
associate-+l-97.0%
neg-sub097.0%
neg-mul-197.0%
distribute-rgt-in97.0%
+-commutative97.0%
Simplified97.0%
if -1.95000000000000012e-7 < x < -2.2500000000000001e-184Initial 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 68.4%
if -2.2500000000000001e-184 < x < -8.20000000000000015e-288 or 1.75e-156 < x < 0.5Initial 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 inf 68.9%
Taylor expanded in x around 0 67.1%
*-commutative67.1%
Simplified67.1%
if -8.20000000000000015e-288 < x < 1.75e-156Initial 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 68.7%
flip3--67.7%
div-inv67.7%
metadata-eval67.7%
metadata-eval67.7%
distribute-rgt-out67.7%
+-commutative67.7%
Applied egg-rr67.7%
Taylor expanded in x around 0 68.7%
Final simplification82.6%
(FPCore (x y)
:precision binary64
(if (<= x -1.95e-7)
(* x y)
(if (<= x -2.9e-184)
0.918938533204673
(if (<= x -2.4e-290)
(* y -0.5)
(if (<= x 1.3e-157)
0.918938533204673
(if (<= x 51000.0) (* y -0.5) (* x y)))))))
double code(double x, double y) {
double tmp;
if (x <= -1.95e-7) {
tmp = x * y;
} else if (x <= -2.9e-184) {
tmp = 0.918938533204673;
} else if (x <= -2.4e-290) {
tmp = y * -0.5;
} else if (x <= 1.3e-157) {
tmp = 0.918938533204673;
} else if (x <= 51000.0) {
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 (x <= (-1.95d-7)) then
tmp = x * y
else if (x <= (-2.9d-184)) then
tmp = 0.918938533204673d0
else if (x <= (-2.4d-290)) then
tmp = y * (-0.5d0)
else if (x <= 1.3d-157) then
tmp = 0.918938533204673d0
else if (x <= 51000.0d0) 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 (x <= -1.95e-7) {
tmp = x * y;
} else if (x <= -2.9e-184) {
tmp = 0.918938533204673;
} else if (x <= -2.4e-290) {
tmp = y * -0.5;
} else if (x <= 1.3e-157) {
tmp = 0.918938533204673;
} else if (x <= 51000.0) {
tmp = y * -0.5;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.95e-7: tmp = x * y elif x <= -2.9e-184: tmp = 0.918938533204673 elif x <= -2.4e-290: tmp = y * -0.5 elif x <= 1.3e-157: tmp = 0.918938533204673 elif x <= 51000.0: tmp = y * -0.5 else: tmp = x * y return tmp
function code(x, y) tmp = 0.0 if (x <= -1.95e-7) tmp = Float64(x * y); elseif (x <= -2.9e-184) tmp = 0.918938533204673; elseif (x <= -2.4e-290) tmp = Float64(y * -0.5); elseif (x <= 1.3e-157) tmp = 0.918938533204673; elseif (x <= 51000.0) tmp = Float64(y * -0.5); else tmp = Float64(x * y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1.95e-7) tmp = x * y; elseif (x <= -2.9e-184) tmp = 0.918938533204673; elseif (x <= -2.4e-290) tmp = y * -0.5; elseif (x <= 1.3e-157) tmp = 0.918938533204673; elseif (x <= 51000.0) tmp = y * -0.5; else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.95e-7], N[(x * y), $MachinePrecision], If[LessEqual[x, -2.9e-184], 0.918938533204673, If[LessEqual[x, -2.4e-290], N[(y * -0.5), $MachinePrecision], If[LessEqual[x, 1.3e-157], 0.918938533204673, If[LessEqual[x, 51000.0], N[(y * -0.5), $MachinePrecision], N[(x * y), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.95 \cdot 10^{-7}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \leq -2.9 \cdot 10^{-184}:\\
\;\;\;\;0.918938533204673\\
\mathbf{elif}\;x \leq -2.4 \cdot 10^{-290}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{-157}:\\
\;\;\;\;0.918938533204673\\
\mathbf{elif}\;x \leq 51000:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if x < -1.95000000000000012e-7 or 51000 < 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--99.9%
unsub-neg99.9%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around inf 58.5%
Taylor expanded in x around inf 56.5%
if -1.95000000000000012e-7 < x < -2.90000000000000014e-184 or -2.4000000000000001e-290 < x < 1.29999999999999994e-157Initial 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 68.5%
flip3--67.5%
div-inv67.5%
metadata-eval67.5%
metadata-eval67.5%
distribute-rgt-out67.5%
+-commutative67.5%
Applied egg-rr67.5%
Taylor expanded in x around 0 68.3%
if -2.90000000000000014e-184 < x < -2.4000000000000001e-290 or 1.29999999999999994e-157 < x < 51000Initial 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 inf 66.7%
Taylor expanded in x around 0 65.0%
*-commutative65.0%
Simplified65.0%
Final simplification61.6%
(FPCore (x y) :precision binary64 (if (or (<= x -2700000.0) (not (<= x 2.3))) (* x (+ y -1.0)) (+ (* x y) (- 0.918938533204673 (* y 0.5)))))
double code(double x, double y) {
double tmp;
if ((x <= -2700000.0) || !(x <= 2.3)) {
tmp = x * (y + -1.0);
} else {
tmp = (x * y) + (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 <= (-2700000.0d0)) .or. (.not. (x <= 2.3d0))) then
tmp = x * (y + (-1.0d0))
else
tmp = (x * y) + (0.918938533204673d0 - (y * 0.5d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -2700000.0) || !(x <= 2.3)) {
tmp = x * (y + -1.0);
} else {
tmp = (x * y) + (0.918938533204673 - (y * 0.5));
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -2700000.0) or not (x <= 2.3): tmp = x * (y + -1.0) else: tmp = (x * y) + (0.918938533204673 - (y * 0.5)) return tmp
function code(x, y) tmp = 0.0 if ((x <= -2700000.0) || !(x <= 2.3)) tmp = Float64(x * Float64(y + -1.0)); else tmp = Float64(Float64(x * y) + Float64(0.918938533204673 - Float64(y * 0.5))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -2700000.0) || ~((x <= 2.3))) tmp = x * (y + -1.0); else tmp = (x * y) + (0.918938533204673 - (y * 0.5)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -2700000.0], N[Not[LessEqual[x, 2.3]], $MachinePrecision]], N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] + N[(0.918938533204673 - N[(y * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2700000 \lor \neg \left(x \leq 2.3\right):\\
\;\;\;\;x \cdot \left(y + -1\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot y + \left(0.918938533204673 - y \cdot 0.5\right)\\
\end{array}
\end{array}
if x < -2.7e6 or 2.2999999999999998 < 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-in99.9%
metadata-eval99.9%
neg-mul-199.9%
associate--r+99.9%
distribute-lft-out--99.9%
unsub-neg99.9%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 98.9%
mul-1-neg98.9%
neg-sub098.9%
distribute-rgt-in98.9%
mul-1-neg98.9%
distribute-lft-neg-in98.9%
*-lft-identity98.9%
sub-neg98.9%
associate-+l-98.9%
neg-sub098.9%
neg-mul-198.9%
distribute-rgt-in98.9%
+-commutative98.9%
Simplified98.9%
if -2.7e6 < x < 2.2999999999999998Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 99.5%
Final simplification99.2%
(FPCore (x y) :precision binary64 (if (or (<= y -1.35) (not (<= y 1.65))) (* y (- x 0.5)) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -1.35) || !(y <= 1.65)) {
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.65d0))) 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.65)) {
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.65): 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.65)) 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.65))) 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.65]], $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.65\right):\\
\;\;\;\;y \cdot \left(x - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\
\end{array}
\end{array}
if y < -1.3500000000000001 or 1.6499999999999999 < y 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--99.9%
unsub-neg99.9%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around inf 95.6%
if -1.3500000000000001 < y < 1.6499999999999999Initial 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.7%
Final simplification96.6%
(FPCore (x y) :precision binary64 (if (or (<= x -0.7) (not (<= x 0.8))) (* x (+ y -1.0)) (- 0.918938533204673 (* y 0.5))))
double code(double x, double y) {
double tmp;
if ((x <= -0.7) || !(x <= 0.8)) {
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.8d0))) 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.8)) {
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.8): 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.8)) 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.8))) 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.8]], $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.8\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.80000000000000004 < 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-in99.9%
metadata-eval99.9%
neg-mul-199.9%
associate--r+99.9%
distribute-lft-out--99.9%
unsub-neg99.9%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 98.3%
mul-1-neg98.3%
neg-sub098.3%
distribute-rgt-in98.2%
mul-1-neg98.2%
distribute-lft-neg-in98.2%
*-lft-identity98.2%
sub-neg98.2%
associate-+l-98.2%
neg-sub098.2%
neg-mul-198.2%
distribute-rgt-in98.3%
+-commutative98.3%
Simplified98.3%
if -0.69999999999999996 < x < 0.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 x around 0 97.6%
*-commutative97.6%
Simplified97.6%
Final simplification97.9%
(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(Float64(0.918938533204673 + 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[(N[(0.918938533204673 + N[(y * N[(x - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]
\begin{array}{l}
\\
\left(0.918938533204673 + y \cdot \left(x - 0.5\right)\right) - x
\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 y around 0 100.0%
Final simplification100.0%
(FPCore (x y) :precision binary64 (if (or (<= x -1.95e-7) (not (<= x 0.78))) (* x y) 0.918938533204673))
double code(double x, double y) {
double tmp;
if ((x <= -1.95e-7) || !(x <= 0.78)) {
tmp = x * y;
} 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 <= (-1.95d-7)) .or. (.not. (x <= 0.78d0))) then
tmp = x * y
else
tmp = 0.918938533204673d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -1.95e-7) || !(x <= 0.78)) {
tmp = x * y;
} else {
tmp = 0.918938533204673;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -1.95e-7) or not (x <= 0.78): tmp = x * y else: tmp = 0.918938533204673 return tmp
function code(x, y) tmp = 0.0 if ((x <= -1.95e-7) || !(x <= 0.78)) tmp = Float64(x * y); else tmp = 0.918938533204673; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -1.95e-7) || ~((x <= 0.78))) tmp = x * y; else tmp = 0.918938533204673; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -1.95e-7], N[Not[LessEqual[x, 0.78]], $MachinePrecision]], N[(x * y), $MachinePrecision], 0.918938533204673]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.95 \cdot 10^{-7} \lor \neg \left(x \leq 0.78\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673\\
\end{array}
\end{array}
if x < -1.95000000000000012e-7 or 0.78000000000000003 < 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-in99.9%
metadata-eval99.9%
neg-mul-199.9%
associate--r+99.9%
distribute-lft-out--99.9%
unsub-neg99.9%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around inf 57.6%
Taylor expanded in x around inf 55.7%
if -1.95000000000000012e-7 < x < 0.78000000000000003Initial 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 51.3%
flip3--50.6%
div-inv50.6%
metadata-eval50.6%
metadata-eval50.6%
distribute-rgt-out50.6%
+-commutative50.6%
Applied egg-rr50.6%
Taylor expanded in x around 0 50.8%
Final simplification53.3%
(FPCore (x y) :precision binary64 (if (or (<= x -0.49) (not (<= x 0.0255))) (- x) 0.918938533204673))
double code(double x, double y) {
double tmp;
if ((x <= -0.49) || !(x <= 0.0255)) {
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.49d0)) .or. (.not. (x <= 0.0255d0))) 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.49) || !(x <= 0.0255)) {
tmp = -x;
} else {
tmp = 0.918938533204673;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -0.49) or not (x <= 0.0255): tmp = -x else: tmp = 0.918938533204673 return tmp
function code(x, y) tmp = 0.0 if ((x <= -0.49) || !(x <= 0.0255)) tmp = Float64(-x); else tmp = 0.918938533204673; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -0.49) || ~((x <= 0.0255))) tmp = -x; else tmp = 0.918938533204673; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -0.49], N[Not[LessEqual[x, 0.0255]], $MachinePrecision]], (-x), 0.918938533204673]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.49 \lor \neg \left(x \leq 0.0255\right):\\
\;\;\;\;-x\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673\\
\end{array}
\end{array}
if x < -0.48999999999999999 or 0.0254999999999999984 < 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-in99.9%
metadata-eval99.9%
neg-mul-199.9%
associate--r+99.9%
distribute-lft-out--99.9%
unsub-neg99.9%
fma-neg100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 41.2%
Taylor expanded in x around inf 40.2%
neg-mul-140.2%
Simplified40.2%
if -0.48999999999999999 < x < 0.0254999999999999984Initial 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 51.3%
flip3--50.6%
div-inv50.6%
metadata-eval50.6%
metadata-eval50.6%
distribute-rgt-out50.6%
+-commutative50.6%
Applied egg-rr50.6%
Taylor expanded in x around 0 50.8%
Final simplification45.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 y around 0 46.2%
flip3--33.9%
div-inv33.9%
metadata-eval33.9%
metadata-eval33.9%
distribute-rgt-out33.9%
+-commutative33.9%
Applied egg-rr33.9%
Taylor expanded in x around 0 26.2%
Final simplification26.2%
herbie shell --seed 2023320
(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))