
(FPCore (x y) :precision binary64 (+ (- (* x (- y 1.0)) (* y 0.5)) 0.918938533204673))
double code(double x, double y) {
return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x * (y - 1.0d0)) - (y * 0.5d0)) + 0.918938533204673d0
end function
public static double code(double x, double y) {
return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673;
}
def code(x, y): return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673
function code(x, y) return Float64(Float64(Float64(x * Float64(y - 1.0)) - Float64(y * 0.5)) + 0.918938533204673) end
function tmp = code(x, y) tmp = ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673; end
code[x_, y_] := N[(N[(N[(x * N[(y - 1.0), $MachinePrecision]), $MachinePrecision] - N[(y * 0.5), $MachinePrecision]), $MachinePrecision] + 0.918938533204673), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (+ (- (* x (- y 1.0)) (* y 0.5)) 0.918938533204673))
double code(double x, double y) {
return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x * (y - 1.0d0)) - (y * 0.5d0)) + 0.918938533204673d0
end function
public static double code(double x, double y) {
return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673;
}
def code(x, y): return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673
function code(x, y) return Float64(Float64(Float64(x * Float64(y - 1.0)) - Float64(y * 0.5)) + 0.918938533204673) end
function tmp = code(x, y) tmp = ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673; end
code[x_, y_] := N[(N[(N[(x * N[(y - 1.0), $MachinePrecision]), $MachinePrecision] - N[(y * 0.5), $MachinePrecision]), $MachinePrecision] + 0.918938533204673), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673
\end{array}
(FPCore (x y) :precision binary64 (+ (- (* x (+ y -1.0)) (* y 0.5)) 0.918938533204673))
double code(double x, double y) {
return ((x * (y + -1.0)) - (y * 0.5)) + 0.918938533204673;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x * (y + (-1.0d0))) - (y * 0.5d0)) + 0.918938533204673d0
end function
public static double code(double x, double y) {
return ((x * (y + -1.0)) - (y * 0.5)) + 0.918938533204673;
}
def code(x, y): return ((x * (y + -1.0)) - (y * 0.5)) + 0.918938533204673
function code(x, y) return Float64(Float64(Float64(x * Float64(y + -1.0)) - Float64(y * 0.5)) + 0.918938533204673) end
function tmp = code(x, y) tmp = ((x * (y + -1.0)) - (y * 0.5)) + 0.918938533204673; end
code[x_, y_] := N[(N[(N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision] - N[(y * 0.5), $MachinePrecision]), $MachinePrecision] + 0.918938533204673), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \left(y + -1\right) - y \cdot 0.5\right) + 0.918938533204673
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(if (<= y -0.62)
(* y -0.5)
(if (<= y -6.8e-173)
(- x)
(if (<= y -5.8e-233)
0.918938533204673
(if (<= y 8.6e-165)
(- x)
(if (<= y 1.85)
0.918938533204673
(if (or (<= y 2.2e+94) (and (not (<= y 3.2e+111)) (<= y 5.8e+169)))
(* y -0.5)
(* x y))))))))
double code(double x, double y) {
double tmp;
if (y <= -0.62) {
tmp = y * -0.5;
} else if (y <= -6.8e-173) {
tmp = -x;
} else if (y <= -5.8e-233) {
tmp = 0.918938533204673;
} else if (y <= 8.6e-165) {
tmp = -x;
} else if (y <= 1.85) {
tmp = 0.918938533204673;
} else if ((y <= 2.2e+94) || (!(y <= 3.2e+111) && (y <= 5.8e+169))) {
tmp = y * -0.5;
} else {
tmp = x * y;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-0.62d0)) then
tmp = y * (-0.5d0)
else if (y <= (-6.8d-173)) then
tmp = -x
else if (y <= (-5.8d-233)) then
tmp = 0.918938533204673d0
else if (y <= 8.6d-165) then
tmp = -x
else if (y <= 1.85d0) then
tmp = 0.918938533204673d0
else if ((y <= 2.2d+94) .or. (.not. (y <= 3.2d+111)) .and. (y <= 5.8d+169)) then
tmp = y * (-0.5d0)
else
tmp = x * y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -0.62) {
tmp = y * -0.5;
} else if (y <= -6.8e-173) {
tmp = -x;
} else if (y <= -5.8e-233) {
tmp = 0.918938533204673;
} else if (y <= 8.6e-165) {
tmp = -x;
} else if (y <= 1.85) {
tmp = 0.918938533204673;
} else if ((y <= 2.2e+94) || (!(y <= 3.2e+111) && (y <= 5.8e+169))) {
tmp = y * -0.5;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -0.62: tmp = y * -0.5 elif y <= -6.8e-173: tmp = -x elif y <= -5.8e-233: tmp = 0.918938533204673 elif y <= 8.6e-165: tmp = -x elif y <= 1.85: tmp = 0.918938533204673 elif (y <= 2.2e+94) or (not (y <= 3.2e+111) and (y <= 5.8e+169)): tmp = y * -0.5 else: tmp = x * y return tmp
function code(x, y) tmp = 0.0 if (y <= -0.62) tmp = Float64(y * -0.5); elseif (y <= -6.8e-173) tmp = Float64(-x); elseif (y <= -5.8e-233) tmp = 0.918938533204673; elseif (y <= 8.6e-165) tmp = Float64(-x); elseif (y <= 1.85) tmp = 0.918938533204673; elseif ((y <= 2.2e+94) || (!(y <= 3.2e+111) && (y <= 5.8e+169))) tmp = Float64(y * -0.5); else tmp = Float64(x * y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -0.62) tmp = y * -0.5; elseif (y <= -6.8e-173) tmp = -x; elseif (y <= -5.8e-233) tmp = 0.918938533204673; elseif (y <= 8.6e-165) tmp = -x; elseif (y <= 1.85) tmp = 0.918938533204673; elseif ((y <= 2.2e+94) || (~((y <= 3.2e+111)) && (y <= 5.8e+169))) tmp = y * -0.5; else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -0.62], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, -6.8e-173], (-x), If[LessEqual[y, -5.8e-233], 0.918938533204673, If[LessEqual[y, 8.6e-165], (-x), If[LessEqual[y, 1.85], 0.918938533204673, If[Or[LessEqual[y, 2.2e+94], And[N[Not[LessEqual[y, 3.2e+111]], $MachinePrecision], LessEqual[y, 5.8e+169]]], N[(y * -0.5), $MachinePrecision], N[(x * y), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.62:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq -6.8 \cdot 10^{-173}:\\
\;\;\;\;-x\\
\mathbf{elif}\;y \leq -5.8 \cdot 10^{-233}:\\
\;\;\;\;0.918938533204673\\
\mathbf{elif}\;y \leq 8.6 \cdot 10^{-165}:\\
\;\;\;\;-x\\
\mathbf{elif}\;y \leq 1.85:\\
\;\;\;\;0.918938533204673\\
\mathbf{elif}\;y \leq 2.2 \cdot 10^{+94} \lor \neg \left(y \leq 3.2 \cdot 10^{+111}\right) \land y \leq 5.8 \cdot 10^{+169}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if y < -0.619999999999999996 or 1.8500000000000001 < y < 2.20000000000000012e94 or 3.2000000000000001e111 < y < 5.8000000000000001e169Initial program 100.0%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
add-cube-cbrt99.6%
pow399.6%
Applied egg-rr99.6%
Taylor expanded in y around inf 56.7%
*-commutative56.7%
Simplified56.7%
if -0.619999999999999996 < y < -6.7999999999999997e-173 or -5.79999999999999964e-233 < y < 8.60000000000000013e-165Initial program 100.0%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
associate--r-100.0%
flip3-+55.9%
*-commutative55.9%
cancel-sign-sub-inv55.9%
fma-def55.9%
metadata-eval55.9%
metadata-eval55.9%
fma-def56.0%
Applied egg-rr56.0%
fma-udef56.0%
distribute-lft-in56.0%
*-commutative56.0%
neg-mul-156.0%
+-commutative56.0%
associate-+r+56.0%
distribute-rgt-in56.0%
+-commutative56.0%
sub-neg56.0%
Simplified56.0%
Taylor expanded in y around 0 55.6%
+-commutative55.6%
mul-1-neg55.6%
unsub-neg55.6%
+-commutative55.6%
unpow255.6%
distribute-rgt-out55.6%
Simplified55.6%
Taylor expanded in x around inf 63.2%
neg-mul-163.2%
Simplified63.2%
if -6.7999999999999997e-173 < y < -5.79999999999999964e-233 or 8.60000000000000013e-165 < y < 1.8500000000000001Initial program 99.9%
associate-+l-99.9%
fma-neg99.9%
sub-neg99.9%
+-commutative99.9%
remove-double-neg99.9%
sub-neg99.9%
fma-neg99.9%
sub-neg99.9%
remove-double-neg99.9%
+-commutative99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 97.8%
neg-mul-197.8%
sub-neg97.8%
Simplified97.8%
Taylor expanded in x around 0 70.8%
if 2.20000000000000012e94 < y < 3.2000000000000001e111 or 5.8000000000000001e169 < y Initial program 100.0%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 66.1%
Taylor expanded in y around inf 66.1%
Final simplification62.5%
(FPCore (x y)
:precision binary64
(if (<= y -6.9)
(* y -0.5)
(if (<= y 1.85)
(- 0.918938533204673 x)
(if (or (<= y 1.1e+93) (and (not (<= y 1.35e+116)) (<= y 1e+168)))
(* y -0.5)
(* x y)))))
double code(double x, double y) {
double tmp;
if (y <= -6.9) {
tmp = y * -0.5;
} else if (y <= 1.85) {
tmp = 0.918938533204673 - x;
} else if ((y <= 1.1e+93) || (!(y <= 1.35e+116) && (y <= 1e+168))) {
tmp = y * -0.5;
} else {
tmp = x * y;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-6.9d0)) then
tmp = y * (-0.5d0)
else if (y <= 1.85d0) then
tmp = 0.918938533204673d0 - x
else if ((y <= 1.1d+93) .or. (.not. (y <= 1.35d+116)) .and. (y <= 1d+168)) then
tmp = y * (-0.5d0)
else
tmp = x * y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -6.9) {
tmp = y * -0.5;
} else if (y <= 1.85) {
tmp = 0.918938533204673 - x;
} else if ((y <= 1.1e+93) || (!(y <= 1.35e+116) && (y <= 1e+168))) {
tmp = y * -0.5;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -6.9: tmp = y * -0.5 elif y <= 1.85: tmp = 0.918938533204673 - x elif (y <= 1.1e+93) or (not (y <= 1.35e+116) and (y <= 1e+168)): tmp = y * -0.5 else: tmp = x * y return tmp
function code(x, y) tmp = 0.0 if (y <= -6.9) tmp = Float64(y * -0.5); elseif (y <= 1.85) tmp = Float64(0.918938533204673 - x); elseif ((y <= 1.1e+93) || (!(y <= 1.35e+116) && (y <= 1e+168))) tmp = Float64(y * -0.5); else tmp = Float64(x * y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -6.9) tmp = y * -0.5; elseif (y <= 1.85) tmp = 0.918938533204673 - x; elseif ((y <= 1.1e+93) || (~((y <= 1.35e+116)) && (y <= 1e+168))) tmp = y * -0.5; else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -6.9], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 1.85], N[(0.918938533204673 - x), $MachinePrecision], If[Or[LessEqual[y, 1.1e+93], And[N[Not[LessEqual[y, 1.35e+116]], $MachinePrecision], LessEqual[y, 1e+168]]], N[(y * -0.5), $MachinePrecision], N[(x * y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.9:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 1.85:\\
\;\;\;\;0.918938533204673 - x\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{+93} \lor \neg \left(y \leq 1.35 \cdot 10^{+116}\right) \land y \leq 10^{+168}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if y < -6.9000000000000004 or 1.8500000000000001 < y < 1.10000000000000011e93 or 1.35e116 < y < 9.9999999999999993e167Initial program 100.0%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
add-cube-cbrt99.6%
pow399.6%
Applied egg-rr99.6%
Taylor expanded in y around inf 56.7%
*-commutative56.7%
Simplified56.7%
if -6.9000000000000004 < y < 1.8500000000000001Initial program 100.0%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 98.9%
neg-mul-198.9%
sub-neg98.9%
Simplified98.9%
if 1.10000000000000011e93 < y < 1.35e116 or 9.9999999999999993e167 < y Initial program 100.0%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 66.1%
Taylor expanded in y around inf 66.1%
Final simplification79.3%
(FPCore (x y)
:precision binary64
(if (<= y -0.0132)
(* y -0.5)
(if (<= y -1.2e-172)
(- x)
(if (<= y -7.6e-233)
0.918938533204673
(if (<= y 3.8e-165)
(- x)
(if (<= y 1.85) 0.918938533204673 (* y -0.5)))))))
double code(double x, double y) {
double tmp;
if (y <= -0.0132) {
tmp = y * -0.5;
} else if (y <= -1.2e-172) {
tmp = -x;
} else if (y <= -7.6e-233) {
tmp = 0.918938533204673;
} else if (y <= 3.8e-165) {
tmp = -x;
} else if (y <= 1.85) {
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 <= (-0.0132d0)) then
tmp = y * (-0.5d0)
else if (y <= (-1.2d-172)) then
tmp = -x
else if (y <= (-7.6d-233)) then
tmp = 0.918938533204673d0
else if (y <= 3.8d-165) then
tmp = -x
else if (y <= 1.85d0) 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 <= -0.0132) {
tmp = y * -0.5;
} else if (y <= -1.2e-172) {
tmp = -x;
} else if (y <= -7.6e-233) {
tmp = 0.918938533204673;
} else if (y <= 3.8e-165) {
tmp = -x;
} else if (y <= 1.85) {
tmp = 0.918938533204673;
} else {
tmp = y * -0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -0.0132: tmp = y * -0.5 elif y <= -1.2e-172: tmp = -x elif y <= -7.6e-233: tmp = 0.918938533204673 elif y <= 3.8e-165: tmp = -x elif y <= 1.85: tmp = 0.918938533204673 else: tmp = y * -0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= -0.0132) tmp = Float64(y * -0.5); elseif (y <= -1.2e-172) tmp = Float64(-x); elseif (y <= -7.6e-233) tmp = 0.918938533204673; elseif (y <= 3.8e-165) tmp = Float64(-x); elseif (y <= 1.85) tmp = 0.918938533204673; else tmp = Float64(y * -0.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -0.0132) tmp = y * -0.5; elseif (y <= -1.2e-172) tmp = -x; elseif (y <= -7.6e-233) tmp = 0.918938533204673; elseif (y <= 3.8e-165) tmp = -x; elseif (y <= 1.85) tmp = 0.918938533204673; else tmp = y * -0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -0.0132], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, -1.2e-172], (-x), If[LessEqual[y, -7.6e-233], 0.918938533204673, If[LessEqual[y, 3.8e-165], (-x), If[LessEqual[y, 1.85], 0.918938533204673, N[(y * -0.5), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.0132:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq -1.2 \cdot 10^{-172}:\\
\;\;\;\;-x\\
\mathbf{elif}\;y \leq -7.6 \cdot 10^{-233}:\\
\;\;\;\;0.918938533204673\\
\mathbf{elif}\;y \leq 3.8 \cdot 10^{-165}:\\
\;\;\;\;-x\\
\mathbf{elif}\;y \leq 1.85:\\
\;\;\;\;0.918938533204673\\
\mathbf{else}:\\
\;\;\;\;y \cdot -0.5\\
\end{array}
\end{array}
if y < -0.0132 or 1.8500000000000001 < y Initial program 100.0%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
add-cube-cbrt99.6%
pow399.6%
Applied egg-rr99.6%
Taylor expanded in y around inf 51.6%
*-commutative51.6%
Simplified51.6%
if -0.0132 < y < -1.2e-172 or -7.5999999999999999e-233 < y < 3.80000000000000018e-165Initial program 100.0%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
associate--r-100.0%
flip3-+55.9%
*-commutative55.9%
cancel-sign-sub-inv55.9%
fma-def55.9%
metadata-eval55.9%
metadata-eval55.9%
fma-def56.0%
Applied egg-rr56.0%
fma-udef56.0%
distribute-lft-in56.0%
*-commutative56.0%
neg-mul-156.0%
+-commutative56.0%
associate-+r+56.0%
distribute-rgt-in56.0%
+-commutative56.0%
sub-neg56.0%
Simplified56.0%
Taylor expanded in y around 0 55.6%
+-commutative55.6%
mul-1-neg55.6%
unsub-neg55.6%
+-commutative55.6%
unpow255.6%
distribute-rgt-out55.6%
Simplified55.6%
Taylor expanded in x around inf 63.2%
neg-mul-163.2%
Simplified63.2%
if -1.2e-172 < y < -7.5999999999999999e-233 or 3.80000000000000018e-165 < y < 1.8500000000000001Initial program 99.9%
associate-+l-99.9%
fma-neg99.9%
sub-neg99.9%
+-commutative99.9%
remove-double-neg99.9%
sub-neg99.9%
fma-neg99.9%
sub-neg99.9%
remove-double-neg99.9%
+-commutative99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 97.8%
neg-mul-197.8%
sub-neg97.8%
Simplified97.8%
Taylor expanded in x around 0 70.8%
Final simplification58.8%
(FPCore (x y) :precision binary64 (if (or (<= y -2.35e-6) (not (<= y 8e-7))) (+ (* x y) (- 0.918938533204673 (* y 0.5))) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -2.35e-6) || !(y <= 8e-7)) {
tmp = (x * y) + (0.918938533204673 - (y * 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 <= (-2.35d-6)) .or. (.not. (y <= 8d-7))) then
tmp = (x * y) + (0.918938533204673d0 - (y * 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 <= -2.35e-6) || !(y <= 8e-7)) {
tmp = (x * y) + (0.918938533204673 - (y * 0.5));
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -2.35e-6) or not (y <= 8e-7): tmp = (x * y) + (0.918938533204673 - (y * 0.5)) else: tmp = 0.918938533204673 - x return tmp
function code(x, y) tmp = 0.0 if ((y <= -2.35e-6) || !(y <= 8e-7)) tmp = Float64(Float64(x * y) + Float64(0.918938533204673 - Float64(y * 0.5))); else tmp = Float64(0.918938533204673 - x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -2.35e-6) || ~((y <= 8e-7))) tmp = (x * y) + (0.918938533204673 - (y * 0.5)); else tmp = 0.918938533204673 - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -2.35e-6], N[Not[LessEqual[y, 8e-7]], $MachinePrecision]], N[(N[(x * y), $MachinePrecision] + N[(0.918938533204673 - N[(y * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.35 \cdot 10^{-6} \lor \neg \left(y \leq 8 \cdot 10^{-7}\right):\\
\;\;\;\;x \cdot y + \left(0.918938533204673 - y \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\
\end{array}
\end{array}
if y < -2.34999999999999995e-6 or 7.9999999999999996e-7 < y Initial program 100.0%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 99.2%
if -2.34999999999999995e-6 < y < 7.9999999999999996e-7Initial program 100.0%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 98.9%
neg-mul-198.9%
sub-neg98.9%
Simplified98.9%
Final simplification99.1%
(FPCore (x y) :precision binary64 (if (<= y -1.5) (* y (- x 0.5)) (if (<= y 1.26) (- 0.918938533204673 x) (- (* x y) (* y 0.5)))))
double code(double x, double y) {
double tmp;
if (y <= -1.5) {
tmp = y * (x - 0.5);
} else if (y <= 1.26) {
tmp = 0.918938533204673 - x;
} else {
tmp = (x * y) - (y * 0.5);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-1.5d0)) then
tmp = y * (x - 0.5d0)
else if (y <= 1.26d0) then
tmp = 0.918938533204673d0 - x
else
tmp = (x * y) - (y * 0.5d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.5) {
tmp = y * (x - 0.5);
} else if (y <= 1.26) {
tmp = 0.918938533204673 - x;
} else {
tmp = (x * y) - (y * 0.5);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.5: tmp = y * (x - 0.5) elif y <= 1.26: tmp = 0.918938533204673 - x else: tmp = (x * y) - (y * 0.5) return tmp
function code(x, y) tmp = 0.0 if (y <= -1.5) tmp = Float64(y * Float64(x - 0.5)); elseif (y <= 1.26) tmp = Float64(0.918938533204673 - x); else tmp = Float64(Float64(x * y) - Float64(y * 0.5)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.5) tmp = y * (x - 0.5); elseif (y <= 1.26) tmp = 0.918938533204673 - x; else tmp = (x * y) - (y * 0.5); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.5], N[(y * N[(x - 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.26], N[(0.918938533204673 - x), $MachinePrecision], N[(N[(x * y), $MachinePrecision] - N[(y * 0.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.5:\\
\;\;\;\;y \cdot \left(x - 0.5\right)\\
\mathbf{elif}\;y \leq 1.26:\\
\;\;\;\;0.918938533204673 - x\\
\mathbf{else}:\\
\;\;\;\;x \cdot y - y \cdot 0.5\\
\end{array}
\end{array}
if y < -1.5Initial program 100.0%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 97.2%
if -1.5 < y < 1.26000000000000001Initial program 100.0%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 98.9%
neg-mul-198.9%
sub-neg98.9%
Simplified98.9%
if 1.26000000000000001 < y Initial program 100.0%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 98.9%
Taylor expanded in y around inf 98.3%
Final simplification98.4%
(FPCore (x y) :precision binary64 (if (or (<= y -1.32) (not (<= y 1.26))) (* y (- x 0.5)) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -1.32) || !(y <= 1.26)) {
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.32d0)) .or. (.not. (y <= 1.26d0))) 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.32) || !(y <= 1.26)) {
tmp = y * (x - 0.5);
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.32) or not (y <= 1.26): tmp = y * (x - 0.5) else: tmp = 0.918938533204673 - x return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.32) || !(y <= 1.26)) 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.32) || ~((y <= 1.26))) tmp = y * (x - 0.5); else tmp = 0.918938533204673 - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.32], N[Not[LessEqual[y, 1.26]], $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.32 \lor \neg \left(y \leq 1.26\right):\\
\;\;\;\;y \cdot \left(x - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\
\end{array}
\end{array}
if y < -1.32000000000000006 or 1.26000000000000001 < y Initial program 100.0%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 97.7%
if -1.32000000000000006 < y < 1.26000000000000001Initial program 100.0%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 98.9%
neg-mul-198.9%
sub-neg98.9%
Simplified98.9%
Final simplification98.3%
(FPCore (x y) :precision binary64 (if (<= x -0.92) (- x) (if (<= x 0.92) 0.918938533204673 (- x))))
double code(double x, double y) {
double tmp;
if (x <= -0.92) {
tmp = -x;
} else if (x <= 0.92) {
tmp = 0.918938533204673;
} else {
tmp = -x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-0.92d0)) then
tmp = -x
else if (x <= 0.92d0) then
tmp = 0.918938533204673d0
else
tmp = -x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -0.92) {
tmp = -x;
} else if (x <= 0.92) {
tmp = 0.918938533204673;
} else {
tmp = -x;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -0.92: tmp = -x elif x <= 0.92: tmp = 0.918938533204673 else: tmp = -x return tmp
function code(x, y) tmp = 0.0 if (x <= -0.92) tmp = Float64(-x); elseif (x <= 0.92) tmp = 0.918938533204673; else tmp = Float64(-x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -0.92) tmp = -x; elseif (x <= 0.92) tmp = 0.918938533204673; else tmp = -x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -0.92], (-x), If[LessEqual[x, 0.92], 0.918938533204673, (-x)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.92:\\
\;\;\;\;-x\\
\mathbf{elif}\;x \leq 0.92:\\
\;\;\;\;0.918938533204673\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
\end{array}
if x < -0.92000000000000004 or 0.92000000000000004 < x Initial program 100.0%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
associate--r-100.0%
flip3-+19.8%
*-commutative19.8%
cancel-sign-sub-inv19.8%
fma-def19.8%
metadata-eval19.8%
metadata-eval19.8%
fma-def19.8%
Applied egg-rr19.8%
fma-udef19.8%
distribute-lft-in19.8%
*-commutative19.8%
neg-mul-119.8%
+-commutative19.8%
associate-+r+19.8%
distribute-rgt-in19.8%
+-commutative19.8%
sub-neg19.8%
Simplified19.8%
Taylor expanded in y around 0 19.9%
+-commutative19.9%
mul-1-neg19.9%
unsub-neg19.9%
+-commutative19.9%
unpow219.9%
distribute-rgt-out19.9%
Simplified19.9%
Taylor expanded in x around inf 51.3%
neg-mul-151.3%
Simplified51.3%
if -0.92000000000000004 < x < 0.92000000000000004Initial program 100.0%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 51.8%
neg-mul-151.8%
sub-neg51.8%
Simplified51.8%
Taylor expanded in x around 0 49.9%
Final simplification50.6%
(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%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 51.9%
neg-mul-151.9%
sub-neg51.9%
Simplified51.9%
Taylor expanded in x around 0 26.8%
Final simplification26.8%
herbie shell --seed 2023224
(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))