
(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 (fma y (+ x -0.5) (- 0.918938533204673 x)))
double code(double x, double y) {
return fma(y, (x + -0.5), (0.918938533204673 - x));
}
function code(x, y) return fma(y, Float64(x + -0.5), Float64(0.918938533204673 - x)) end
code[x_, y_] := N[(y * N[(x + -0.5), $MachinePrecision] + N[(0.918938533204673 - x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, x + -0.5, 0.918938533204673 - x\right)
\end{array}
Initial program 100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate-+r+100.0%
unsub-neg100.0%
associate-+l-100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
distribute-lft-out100.0%
fma-neg100.0%
+-commutative100.0%
metadata-eval100.0%
neg-sub0100.0%
associate-+l-100.0%
neg-sub0100.0%
+-commutative100.0%
unsub-neg100.0%
Simplified100.0%
(FPCore (x y)
:precision binary64
(if (<= y -1.3e+141)
(* y -0.5)
(if (<= y -7.0)
(* y x)
(if (<= y 1.35)
(- 0.918938533204673 x)
(if (or (<= y 1.1e+31) (not (<= y 4.6e+134))) (* y x) (* y -0.5))))))
double code(double x, double y) {
double tmp;
if (y <= -1.3e+141) {
tmp = y * -0.5;
} else if (y <= -7.0) {
tmp = y * x;
} else if (y <= 1.35) {
tmp = 0.918938533204673 - x;
} else if ((y <= 1.1e+31) || !(y <= 4.6e+134)) {
tmp = y * x;
} 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.3d+141)) then
tmp = y * (-0.5d0)
else if (y <= (-7.0d0)) then
tmp = y * x
else if (y <= 1.35d0) then
tmp = 0.918938533204673d0 - x
else if ((y <= 1.1d+31) .or. (.not. (y <= 4.6d+134))) then
tmp = y * x
else
tmp = y * (-0.5d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.3e+141) {
tmp = y * -0.5;
} else if (y <= -7.0) {
tmp = y * x;
} else if (y <= 1.35) {
tmp = 0.918938533204673 - x;
} else if ((y <= 1.1e+31) || !(y <= 4.6e+134)) {
tmp = y * x;
} else {
tmp = y * -0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.3e+141: tmp = y * -0.5 elif y <= -7.0: tmp = y * x elif y <= 1.35: tmp = 0.918938533204673 - x elif (y <= 1.1e+31) or not (y <= 4.6e+134): tmp = y * x else: tmp = y * -0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= -1.3e+141) tmp = Float64(y * -0.5); elseif (y <= -7.0) tmp = Float64(y * x); elseif (y <= 1.35) tmp = Float64(0.918938533204673 - x); elseif ((y <= 1.1e+31) || !(y <= 4.6e+134)) tmp = Float64(y * x); else tmp = Float64(y * -0.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.3e+141) tmp = y * -0.5; elseif (y <= -7.0) tmp = y * x; elseif (y <= 1.35) tmp = 0.918938533204673 - x; elseif ((y <= 1.1e+31) || ~((y <= 4.6e+134))) tmp = y * x; else tmp = y * -0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.3e+141], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, -7.0], N[(y * x), $MachinePrecision], If[LessEqual[y, 1.35], N[(0.918938533204673 - x), $MachinePrecision], If[Or[LessEqual[y, 1.1e+31], N[Not[LessEqual[y, 4.6e+134]], $MachinePrecision]], N[(y * x), $MachinePrecision], N[(y * -0.5), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.3 \cdot 10^{+141}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq -7:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq 1.35:\\
\;\;\;\;0.918938533204673 - x\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{+31} \lor \neg \left(y \leq 4.6 \cdot 10^{+134}\right):\\
\;\;\;\;y \cdot x\\
\mathbf{else}:\\
\;\;\;\;y \cdot -0.5\\
\end{array}
\end{array}
if y < -1.3e141 or 1.10000000000000005e31 < y < 4.5999999999999996e134Initial 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.6%
if -1.3e141 < y < -7 or 1.3500000000000001 < y < 1.10000000000000005e31 or 4.5999999999999996e134 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 94.7%
Taylor expanded in x around inf 62.5%
if -7 < y < 1.3500000000000001Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 97.4%
neg-mul-197.4%
sub-neg97.4%
Simplified97.4%
Final simplification81.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* x (+ y -1.0))))
(if (<= y -8.5e+142)
(* y -0.5)
(if (<= y -1.35)
t_0
(if (<= y 0.0026)
(- 0.918938533204673 x)
(if (<= y 8e+28) t_0 (if (<= y 1.9e+136) (* y -0.5) (* y x))))))))
double code(double x, double y) {
double t_0 = x * (y + -1.0);
double tmp;
if (y <= -8.5e+142) {
tmp = y * -0.5;
} else if (y <= -1.35) {
tmp = t_0;
} else if (y <= 0.0026) {
tmp = 0.918938533204673 - x;
} else if (y <= 8e+28) {
tmp = t_0;
} else if (y <= 1.9e+136) {
tmp = y * -0.5;
} else {
tmp = y * x;
}
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 (y <= (-8.5d+142)) then
tmp = y * (-0.5d0)
else if (y <= (-1.35d0)) then
tmp = t_0
else if (y <= 0.0026d0) then
tmp = 0.918938533204673d0 - x
else if (y <= 8d+28) then
tmp = t_0
else if (y <= 1.9d+136) then
tmp = y * (-0.5d0)
else
tmp = y * x
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x * (y + -1.0);
double tmp;
if (y <= -8.5e+142) {
tmp = y * -0.5;
} else if (y <= -1.35) {
tmp = t_0;
} else if (y <= 0.0026) {
tmp = 0.918938533204673 - x;
} else if (y <= 8e+28) {
tmp = t_0;
} else if (y <= 1.9e+136) {
tmp = y * -0.5;
} else {
tmp = y * x;
}
return tmp;
}
def code(x, y): t_0 = x * (y + -1.0) tmp = 0 if y <= -8.5e+142: tmp = y * -0.5 elif y <= -1.35: tmp = t_0 elif y <= 0.0026: tmp = 0.918938533204673 - x elif y <= 8e+28: tmp = t_0 elif y <= 1.9e+136: tmp = y * -0.5 else: tmp = y * x return tmp
function code(x, y) t_0 = Float64(x * Float64(y + -1.0)) tmp = 0.0 if (y <= -8.5e+142) tmp = Float64(y * -0.5); elseif (y <= -1.35) tmp = t_0; elseif (y <= 0.0026) tmp = Float64(0.918938533204673 - x); elseif (y <= 8e+28) tmp = t_0; elseif (y <= 1.9e+136) tmp = Float64(y * -0.5); else tmp = Float64(y * x); end return tmp end
function tmp_2 = code(x, y) t_0 = x * (y + -1.0); tmp = 0.0; if (y <= -8.5e+142) tmp = y * -0.5; elseif (y <= -1.35) tmp = t_0; elseif (y <= 0.0026) tmp = 0.918938533204673 - x; elseif (y <= 8e+28) tmp = t_0; elseif (y <= 1.9e+136) tmp = y * -0.5; else tmp = y * x; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -8.5e+142], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, -1.35], t$95$0, If[LessEqual[y, 0.0026], N[(0.918938533204673 - x), $MachinePrecision], If[LessEqual[y, 8e+28], t$95$0, If[LessEqual[y, 1.9e+136], N[(y * -0.5), $MachinePrecision], N[(y * x), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(y + -1\right)\\
\mathbf{if}\;y \leq -8.5 \cdot 10^{+142}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq -1.35:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 0.0026:\\
\;\;\;\;0.918938533204673 - x\\
\mathbf{elif}\;y \leq 8 \cdot 10^{+28}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{+136}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}
\end{array}
if y < -8.49999999999999955e142 or 7.99999999999999967e28 < y < 1.90000000000000007e136Initial 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.6%
if -8.49999999999999955e142 < y < -1.3500000000000001 or 0.0025999999999999999 < y < 7.99999999999999967e28Initial program 99.9%
cancel-sign-sub-inv99.9%
+-commutative99.9%
sub-neg99.9%
distribute-rgt-in99.9%
metadata-eval99.9%
neg-mul-199.9%
associate-+r+99.9%
unsub-neg99.9%
associate-+l-99.9%
distribute-lft-neg-out99.9%
distribute-rgt-neg-in99.9%
distribute-lft-out99.9%
fma-neg100.0%
+-commutative100.0%
metadata-eval100.0%
neg-sub0100.0%
associate-+l-100.0%
neg-sub0100.0%
+-commutative100.0%
unsub-neg100.0%
Simplified100.0%
fma-undefine99.9%
associate-+r-99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 71.2%
if -1.3500000000000001 < y < 0.0025999999999999999Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 97.9%
neg-mul-197.9%
sub-neg97.9%
Simplified97.9%
if 1.90000000000000007e136 < y Initial 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 inf 61.4%
Final simplification83.4%
(FPCore (x y)
:precision binary64
(if (<= x -60000000.0)
(- x)
(if (<= x -4.2e-88)
(* y -0.5)
(if (<= x 6.5e-81)
0.918938533204673
(if (<= x 0.5) (* y -0.5) (* y x))))))
double code(double x, double y) {
double tmp;
if (x <= -60000000.0) {
tmp = -x;
} else if (x <= -4.2e-88) {
tmp = y * -0.5;
} else if (x <= 6.5e-81) {
tmp = 0.918938533204673;
} else if (x <= 0.5) {
tmp = y * -0.5;
} else {
tmp = y * x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-60000000.0d0)) then
tmp = -x
else if (x <= (-4.2d-88)) then
tmp = y * (-0.5d0)
else if (x <= 6.5d-81) then
tmp = 0.918938533204673d0
else if (x <= 0.5d0) then
tmp = y * (-0.5d0)
else
tmp = y * x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -60000000.0) {
tmp = -x;
} else if (x <= -4.2e-88) {
tmp = y * -0.5;
} else if (x <= 6.5e-81) {
tmp = 0.918938533204673;
} else if (x <= 0.5) {
tmp = y * -0.5;
} else {
tmp = y * x;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -60000000.0: tmp = -x elif x <= -4.2e-88: tmp = y * -0.5 elif x <= 6.5e-81: tmp = 0.918938533204673 elif x <= 0.5: tmp = y * -0.5 else: tmp = y * x return tmp
function code(x, y) tmp = 0.0 if (x <= -60000000.0) tmp = Float64(-x); elseif (x <= -4.2e-88) tmp = Float64(y * -0.5); elseif (x <= 6.5e-81) tmp = 0.918938533204673; elseif (x <= 0.5) tmp = Float64(y * -0.5); else tmp = Float64(y * x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -60000000.0) tmp = -x; elseif (x <= -4.2e-88) tmp = y * -0.5; elseif (x <= 6.5e-81) tmp = 0.918938533204673; elseif (x <= 0.5) tmp = y * -0.5; else tmp = y * x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -60000000.0], (-x), If[LessEqual[x, -4.2e-88], N[(y * -0.5), $MachinePrecision], If[LessEqual[x, 6.5e-81], 0.918938533204673, If[LessEqual[x, 0.5], N[(y * -0.5), $MachinePrecision], N[(y * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -60000000:\\
\;\;\;\;-x\\
\mathbf{elif}\;x \leq -4.2 \cdot 10^{-88}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;x \leq 6.5 \cdot 10^{-81}:\\
\;\;\;\;0.918938533204673\\
\mathbf{elif}\;x \leq 0.5:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}
\end{array}
if x < -6e7Initial program 100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate-+r+100.0%
unsub-neg100.0%
associate-+l-100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
distribute-lft-out100.0%
fma-neg100.0%
+-commutative100.0%
metadata-eval100.0%
neg-sub0100.0%
associate-+l-100.0%
neg-sub0100.0%
+-commutative100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in x around -inf 99.5%
Taylor expanded in y around 0 54.6%
neg-mul-154.6%
Simplified54.6%
if -6e7 < x < -4.1999999999999999e-88 or 6.5000000000000002e-81 < x < 0.5Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 72.0%
Taylor expanded in x around 0 63.2%
if -4.1999999999999999e-88 < x < 6.5000000000000002e-81Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 62.9%
neg-mul-162.9%
sub-neg62.9%
Simplified62.9%
Taylor expanded in x around 0 62.9%
if 0.5 < x Initial program 99.9%
associate-+l-99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf 53.3%
Taylor expanded in x around inf 53.3%
(FPCore (x y)
:precision binary64
(if (<= x -60000000.0)
(- x)
(if (<= x -1.55e-82)
(* y -0.5)
(if (<= x 1.28e-79) 0.918938533204673 (if (<= x 0.7) (* y -0.5) (- x))))))
double code(double x, double y) {
double tmp;
if (x <= -60000000.0) {
tmp = -x;
} else if (x <= -1.55e-82) {
tmp = y * -0.5;
} else if (x <= 1.28e-79) {
tmp = 0.918938533204673;
} else if (x <= 0.7) {
tmp = y * -0.5;
} 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 <= (-60000000.0d0)) then
tmp = -x
else if (x <= (-1.55d-82)) then
tmp = y * (-0.5d0)
else if (x <= 1.28d-79) then
tmp = 0.918938533204673d0
else if (x <= 0.7d0) then
tmp = y * (-0.5d0)
else
tmp = -x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -60000000.0) {
tmp = -x;
} else if (x <= -1.55e-82) {
tmp = y * -0.5;
} else if (x <= 1.28e-79) {
tmp = 0.918938533204673;
} else if (x <= 0.7) {
tmp = y * -0.5;
} else {
tmp = -x;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -60000000.0: tmp = -x elif x <= -1.55e-82: tmp = y * -0.5 elif x <= 1.28e-79: tmp = 0.918938533204673 elif x <= 0.7: tmp = y * -0.5 else: tmp = -x return tmp
function code(x, y) tmp = 0.0 if (x <= -60000000.0) tmp = Float64(-x); elseif (x <= -1.55e-82) tmp = Float64(y * -0.5); elseif (x <= 1.28e-79) tmp = 0.918938533204673; elseif (x <= 0.7) tmp = Float64(y * -0.5); else tmp = Float64(-x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -60000000.0) tmp = -x; elseif (x <= -1.55e-82) tmp = y * -0.5; elseif (x <= 1.28e-79) tmp = 0.918938533204673; elseif (x <= 0.7) tmp = y * -0.5; else tmp = -x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -60000000.0], (-x), If[LessEqual[x, -1.55e-82], N[(y * -0.5), $MachinePrecision], If[LessEqual[x, 1.28e-79], 0.918938533204673, If[LessEqual[x, 0.7], N[(y * -0.5), $MachinePrecision], (-x)]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -60000000:\\
\;\;\;\;-x\\
\mathbf{elif}\;x \leq -1.55 \cdot 10^{-82}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;x \leq 1.28 \cdot 10^{-79}:\\
\;\;\;\;0.918938533204673\\
\mathbf{elif}\;x \leq 0.7:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
\end{array}
if x < -6e7 or 0.69999999999999996 < x Initial program 100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate-+r+100.0%
unsub-neg100.0%
associate-+l-100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
distribute-lft-out100.0%
fma-neg100.0%
+-commutative100.0%
metadata-eval100.0%
neg-sub0100.0%
associate-+l-100.0%
neg-sub0100.0%
+-commutative100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in x around -inf 99.7%
Taylor expanded in y around 0 50.4%
neg-mul-150.4%
Simplified50.4%
if -6e7 < x < -1.55e-82 or 1.28e-79 < x < 0.69999999999999996Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 72.0%
Taylor expanded in x around 0 63.2%
if -1.55e-82 < x < 1.28e-79Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 62.9%
neg-mul-162.9%
sub-neg62.9%
Simplified62.9%
Taylor expanded in x around 0 62.9%
(FPCore (x y) :precision binary64 (if (or (<= x -4200000.0) (not (<= x 650000.0))) (* x (+ y -1.0)) (+ (* y x) (- 0.918938533204673 (* y 0.5)))))
double code(double x, double y) {
double tmp;
if ((x <= -4200000.0) || !(x <= 650000.0)) {
tmp = x * (y + -1.0);
} else {
tmp = (y * x) + (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 <= (-4200000.0d0)) .or. (.not. (x <= 650000.0d0))) then
tmp = x * (y + (-1.0d0))
else
tmp = (y * x) + (0.918938533204673d0 - (y * 0.5d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -4200000.0) || !(x <= 650000.0)) {
tmp = x * (y + -1.0);
} else {
tmp = (y * x) + (0.918938533204673 - (y * 0.5));
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -4200000.0) or not (x <= 650000.0): tmp = x * (y + -1.0) else: tmp = (y * x) + (0.918938533204673 - (y * 0.5)) return tmp
function code(x, y) tmp = 0.0 if ((x <= -4200000.0) || !(x <= 650000.0)) tmp = Float64(x * Float64(y + -1.0)); else tmp = Float64(Float64(y * x) + Float64(0.918938533204673 - Float64(y * 0.5))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -4200000.0) || ~((x <= 650000.0))) tmp = x * (y + -1.0); else tmp = (y * x) + (0.918938533204673 - (y * 0.5)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -4200000.0], N[Not[LessEqual[x, 650000.0]], $MachinePrecision]], N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(y * x), $MachinePrecision] + N[(0.918938533204673 - N[(y * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4200000 \lor \neg \left(x \leq 650000\right):\\
\;\;\;\;x \cdot \left(y + -1\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot x + \left(0.918938533204673 - y \cdot 0.5\right)\\
\end{array}
\end{array}
if x < -4.2e6 or 6.5e5 < x Initial program 100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate-+r+100.0%
unsub-neg100.0%
associate-+l-100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
distribute-lft-out100.0%
fma-neg100.0%
+-commutative100.0%
metadata-eval100.0%
neg-sub0100.0%
associate-+l-100.0%
neg-sub0100.0%
+-commutative100.0%
unsub-neg100.0%
Simplified100.0%
fma-undefine100.0%
associate-+r-100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 99.4%
if -4.2e6 < x < 6.5e5Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
Final simplification99.7%
(FPCore (x y) :precision binary64 (if (or (<= x -0.65) (not (<= x 0.9))) (* x (+ y -1.0)) (- 0.918938533204673 (* y 0.5))))
double code(double x, double y) {
double tmp;
if ((x <= -0.65) || !(x <= 0.9)) {
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.65d0)) .or. (.not. (x <= 0.9d0))) 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.65) || !(x <= 0.9)) {
tmp = x * (y + -1.0);
} else {
tmp = 0.918938533204673 - (y * 0.5);
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -0.65) or not (x <= 0.9): tmp = x * (y + -1.0) else: tmp = 0.918938533204673 - (y * 0.5) return tmp
function code(x, y) tmp = 0.0 if ((x <= -0.65) || !(x <= 0.9)) 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.65) || ~((x <= 0.9))) 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.65], N[Not[LessEqual[x, 0.9]], $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.65 \lor \neg \left(x \leq 0.9\right):\\
\;\;\;\;x \cdot \left(y + -1\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - y \cdot 0.5\\
\end{array}
\end{array}
if x < -0.650000000000000022 or 0.900000000000000022 < x Initial program 100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate-+r+100.0%
unsub-neg100.0%
associate-+l-100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
distribute-lft-out100.0%
fma-neg100.0%
+-commutative100.0%
metadata-eval100.0%
neg-sub0100.0%
associate-+l-100.0%
neg-sub0100.0%
+-commutative100.0%
unsub-neg100.0%
Simplified100.0%
fma-undefine100.0%
associate-+r-100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 98.8%
if -0.650000000000000022 < x < 0.900000000000000022Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 98.7%
*-commutative98.7%
Simplified98.7%
Final simplification98.7%
(FPCore (x y) :precision binary64 (if (or (<= y -1.5) (not (<= y 1.62))) (* y (- x 0.5)) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -1.5) || !(y <= 1.62)) {
tmp = y * (x - 0.5);
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-1.5d0)) .or. (.not. (y <= 1.62d0))) then
tmp = y * (x - 0.5d0)
else
tmp = 0.918938533204673d0 - x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -1.5) || !(y <= 1.62)) {
tmp = y * (x - 0.5);
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.5) or not (y <= 1.62): tmp = y * (x - 0.5) else: tmp = 0.918938533204673 - x return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.5) || !(y <= 1.62)) tmp = Float64(y * Float64(x - 0.5)); else tmp = Float64(0.918938533204673 - x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1.5) || ~((y <= 1.62))) tmp = y * (x - 0.5); else tmp = 0.918938533204673 - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.5], N[Not[LessEqual[y, 1.62]], $MachinePrecision]], N[(y * N[(x - 0.5), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.5 \lor \neg \left(y \leq 1.62\right):\\
\;\;\;\;y \cdot \left(x - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\
\end{array}
\end{array}
if y < -1.5 or 1.6200000000000001 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 96.8%
if -1.5 < y < 1.6200000000000001Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 97.4%
neg-mul-197.4%
sub-neg97.4%
Simplified97.4%
Final simplification97.1%
(FPCore (x y) :precision binary64 (if (or (<= x -4.8e-16) (not (<= x 1.5e-11))) (- x) 0.918938533204673))
double code(double x, double y) {
double tmp;
if ((x <= -4.8e-16) || !(x <= 1.5e-11)) {
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 <= (-4.8d-16)) .or. (.not. (x <= 1.5d-11))) 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 <= -4.8e-16) || !(x <= 1.5e-11)) {
tmp = -x;
} else {
tmp = 0.918938533204673;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -4.8e-16) or not (x <= 1.5e-11): tmp = -x else: tmp = 0.918938533204673 return tmp
function code(x, y) tmp = 0.0 if ((x <= -4.8e-16) || !(x <= 1.5e-11)) tmp = Float64(-x); else tmp = 0.918938533204673; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -4.8e-16) || ~((x <= 1.5e-11))) tmp = -x; else tmp = 0.918938533204673; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -4.8e-16], N[Not[LessEqual[x, 1.5e-11]], $MachinePrecision]], (-x), 0.918938533204673]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.8 \cdot 10^{-16} \lor \neg \left(x \leq 1.5 \cdot 10^{-11}\right):\\
\;\;\;\;-x\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673\\
\end{array}
\end{array}
if x < -4.8000000000000001e-16 or 1.5e-11 < x Initial program 100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate-+r+100.0%
unsub-neg100.0%
associate-+l-100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
distribute-lft-out100.0%
fma-neg100.0%
+-commutative100.0%
metadata-eval100.0%
neg-sub0100.0%
associate-+l-100.0%
neg-sub0100.0%
+-commutative100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in x around -inf 94.5%
Taylor expanded in y around 0 47.4%
neg-mul-147.4%
Simplified47.4%
if -4.8000000000000001e-16 < x < 1.5e-11Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 57.9%
neg-mul-157.9%
sub-neg57.9%
Simplified57.9%
Taylor expanded in x around 0 57.9%
Final simplification52.6%
(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%
cancel-sign-sub-inv100.0%
+-commutative100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate-+r+100.0%
unsub-neg100.0%
associate-+l-100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
distribute-lft-out100.0%
fma-neg100.0%
+-commutative100.0%
metadata-eval100.0%
neg-sub0100.0%
associate-+l-100.0%
neg-sub0100.0%
+-commutative100.0%
unsub-neg100.0%
Simplified100.0%
fma-undefine100.0%
associate-+r-100.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%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 52.7%
neg-mul-152.7%
sub-neg52.7%
Simplified52.7%
Taylor expanded in x around 0 29.9%
herbie shell --seed 2024146
(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))