
(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 x (+ y -1.0) (* y -0.5)) 0.918938533204673))
double code(double x, double y) {
return fma(x, (y + -1.0), (y * -0.5)) + 0.918938533204673;
}
function code(x, y) return Float64(fma(x, Float64(y + -1.0), Float64(y * -0.5)) + 0.918938533204673) end
code[x_, y_] := N[(N[(x * N[(y + -1.0), $MachinePrecision] + N[(y * -0.5), $MachinePrecision]), $MachinePrecision] + 0.918938533204673), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, y + -1, y \cdot -0.5\right) + 0.918938533204673
\end{array}
Initial program 100.0%
fmm-def100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
Simplified100.0%
(FPCore (x y)
:precision binary64
(if (<= y -6.6e-9)
(* y -0.5)
(if (<= y -2.5e-218)
0.918938533204673
(if (<= y 3.2e-111)
(- x)
(if (<= y 1.85)
0.918938533204673
(if (<= y 1.75e+268) (* y -0.5) (* x y)))))))
double code(double x, double y) {
double tmp;
if (y <= -6.6e-9) {
tmp = y * -0.5;
} else if (y <= -2.5e-218) {
tmp = 0.918938533204673;
} else if (y <= 3.2e-111) {
tmp = -x;
} else if (y <= 1.85) {
tmp = 0.918938533204673;
} else if (y <= 1.75e+268) {
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.6d-9)) then
tmp = y * (-0.5d0)
else if (y <= (-2.5d-218)) then
tmp = 0.918938533204673d0
else if (y <= 3.2d-111) then
tmp = -x
else if (y <= 1.85d0) then
tmp = 0.918938533204673d0
else if (y <= 1.75d+268) 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.6e-9) {
tmp = y * -0.5;
} else if (y <= -2.5e-218) {
tmp = 0.918938533204673;
} else if (y <= 3.2e-111) {
tmp = -x;
} else if (y <= 1.85) {
tmp = 0.918938533204673;
} else if (y <= 1.75e+268) {
tmp = y * -0.5;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -6.6e-9: tmp = y * -0.5 elif y <= -2.5e-218: tmp = 0.918938533204673 elif y <= 3.2e-111: tmp = -x elif y <= 1.85: tmp = 0.918938533204673 elif y <= 1.75e+268: tmp = y * -0.5 else: tmp = x * y return tmp
function code(x, y) tmp = 0.0 if (y <= -6.6e-9) tmp = Float64(y * -0.5); elseif (y <= -2.5e-218) tmp = 0.918938533204673; elseif (y <= 3.2e-111) tmp = Float64(-x); elseif (y <= 1.85) tmp = 0.918938533204673; elseif (y <= 1.75e+268) 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.6e-9) tmp = y * -0.5; elseif (y <= -2.5e-218) tmp = 0.918938533204673; elseif (y <= 3.2e-111) tmp = -x; elseif (y <= 1.85) tmp = 0.918938533204673; elseif (y <= 1.75e+268) tmp = y * -0.5; else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -6.6e-9], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, -2.5e-218], 0.918938533204673, If[LessEqual[y, 3.2e-111], (-x), If[LessEqual[y, 1.85], 0.918938533204673, If[LessEqual[y, 1.75e+268], N[(y * -0.5), $MachinePrecision], N[(x * y), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.6 \cdot 10^{-9}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq -2.5 \cdot 10^{-218}:\\
\;\;\;\;0.918938533204673\\
\mathbf{elif}\;y \leq 3.2 \cdot 10^{-111}:\\
\;\;\;\;-x\\
\mathbf{elif}\;y \leq 1.85:\\
\;\;\;\;0.918938533204673\\
\mathbf{elif}\;y \leq 1.75 \cdot 10^{+268}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if y < -6.60000000000000037e-9 or 1.8500000000000001 < y < 1.74999999999999986e268Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in y around inf 96.2%
Taylor expanded in x around 0 59.6%
if -6.60000000000000037e-9 < y < -2.50000000000000021e-218 or 3.1999999999999998e-111 < y < 1.8500000000000001Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around inf 67.3%
Taylor expanded in y around 0 64.6%
if -2.50000000000000021e-218 < y < 3.1999999999999998e-111Initial program 100.0%
fmm-def100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
neg-mul-1100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 65.2%
neg-mul-165.2%
Simplified65.2%
if 1.74999999999999986e268 < y Initial program 99.9%
+-commutative99.9%
cancel-sign-sub-inv99.9%
+-commutative99.9%
associate-+r+99.9%
cancel-sign-sub-inv99.9%
associate-+l-99.9%
sub-neg99.9%
distribute-rgt-in99.9%
metadata-eval99.9%
neg-mul-199.9%
associate--r+99.9%
distribute-lft-out--100.0%
unsub-neg100.0%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in y around inf 100.0%
Taylor expanded in x around inf 63.3%
*-commutative63.3%
Simplified63.3%
Final simplification62.3%
(FPCore (x y)
:precision binary64
(if (<= y -6.6e-9)
(* y -0.5)
(if (<= y -2.05e-218)
0.918938533204673
(if (<= y 1.05e-111)
(- x)
(if (<= y 1.85) 0.918938533204673 (* y -0.5))))))
double code(double x, double y) {
double tmp;
if (y <= -6.6e-9) {
tmp = y * -0.5;
} else if (y <= -2.05e-218) {
tmp = 0.918938533204673;
} else if (y <= 1.05e-111) {
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 <= (-6.6d-9)) then
tmp = y * (-0.5d0)
else if (y <= (-2.05d-218)) then
tmp = 0.918938533204673d0
else if (y <= 1.05d-111) 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 <= -6.6e-9) {
tmp = y * -0.5;
} else if (y <= -2.05e-218) {
tmp = 0.918938533204673;
} else if (y <= 1.05e-111) {
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 <= -6.6e-9: tmp = y * -0.5 elif y <= -2.05e-218: tmp = 0.918938533204673 elif y <= 1.05e-111: 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 <= -6.6e-9) tmp = Float64(y * -0.5); elseif (y <= -2.05e-218) tmp = 0.918938533204673; elseif (y <= 1.05e-111) 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 <= -6.6e-9) tmp = y * -0.5; elseif (y <= -2.05e-218) tmp = 0.918938533204673; elseif (y <= 1.05e-111) 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, -6.6e-9], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, -2.05e-218], 0.918938533204673, If[LessEqual[y, 1.05e-111], (-x), If[LessEqual[y, 1.85], 0.918938533204673, N[(y * -0.5), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.6 \cdot 10^{-9}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq -2.05 \cdot 10^{-218}:\\
\;\;\;\;0.918938533204673\\
\mathbf{elif}\;y \leq 1.05 \cdot 10^{-111}:\\
\;\;\;\;-x\\
\mathbf{elif}\;y \leq 1.85:\\
\;\;\;\;0.918938533204673\\
\mathbf{else}:\\
\;\;\;\;y \cdot -0.5\\
\end{array}
\end{array}
if y < -6.60000000000000037e-9 or 1.8500000000000001 < 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--100.0%
unsub-neg100.0%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in y around inf 96.5%
Taylor expanded in x around 0 55.9%
if -6.60000000000000037e-9 < y < -2.0499999999999999e-218 or 1.0499999999999999e-111 < y < 1.8500000000000001Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around inf 67.3%
Taylor expanded in y around 0 64.6%
if -2.0499999999999999e-218 < y < 1.0499999999999999e-111Initial program 100.0%
fmm-def100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
neg-mul-1100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 65.2%
neg-mul-165.2%
Simplified65.2%
(FPCore (x y)
:precision binary64
(if (<= y -255.0)
(* y -0.5)
(if (<= y 1.85)
(- 0.918938533204673 x)
(if (<= y 1.2e+268) (* y -0.5) (* x y)))))
double code(double x, double y) {
double tmp;
if (y <= -255.0) {
tmp = y * -0.5;
} else if (y <= 1.85) {
tmp = 0.918938533204673 - x;
} else if (y <= 1.2e+268) {
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 <= (-255.0d0)) then
tmp = y * (-0.5d0)
else if (y <= 1.85d0) then
tmp = 0.918938533204673d0 - x
else if (y <= 1.2d+268) 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 <= -255.0) {
tmp = y * -0.5;
} else if (y <= 1.85) {
tmp = 0.918938533204673 - x;
} else if (y <= 1.2e+268) {
tmp = y * -0.5;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -255.0: tmp = y * -0.5 elif y <= 1.85: tmp = 0.918938533204673 - x elif y <= 1.2e+268: tmp = y * -0.5 else: tmp = x * y return tmp
function code(x, y) tmp = 0.0 if (y <= -255.0) tmp = Float64(y * -0.5); elseif (y <= 1.85) tmp = Float64(0.918938533204673 - x); elseif (y <= 1.2e+268) 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 <= -255.0) tmp = y * -0.5; elseif (y <= 1.85) tmp = 0.918938533204673 - x; elseif (y <= 1.2e+268) tmp = y * -0.5; else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -255.0], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 1.85], N[(0.918938533204673 - x), $MachinePrecision], If[LessEqual[y, 1.2e+268], N[(y * -0.5), $MachinePrecision], N[(x * y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -255:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 1.85:\\
\;\;\;\;0.918938533204673 - x\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{+268}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if y < -255 or 1.8500000000000001 < y < 1.2e268Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in y around inf 97.6%
Taylor expanded in x around 0 60.6%
if -255 < y < 1.8500000000000001Initial program 100.0%
fmm-def100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 98.1%
neg-mul-198.1%
sub-neg98.1%
Simplified98.1%
if 1.2e268 < y Initial program 99.9%
+-commutative99.9%
cancel-sign-sub-inv99.9%
+-commutative99.9%
associate-+r+99.9%
cancel-sign-sub-inv99.9%
associate-+l-99.9%
sub-neg99.9%
distribute-rgt-in99.9%
metadata-eval99.9%
neg-mul-199.9%
associate--r+99.9%
distribute-lft-out--100.0%
unsub-neg100.0%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in y around inf 100.0%
Taylor expanded in x around inf 63.3%
*-commutative63.3%
Simplified63.3%
Final simplification78.5%
(FPCore (x y) :precision binary64 (if (or (<= y -0.35) (not (<= y 44.0))) (+ 0.918938533204673 (* y (- x 0.5))) (+ 0.918938533204673 (* x (+ y -1.0)))))
double code(double x, double y) {
double tmp;
if ((y <= -0.35) || !(y <= 44.0)) {
tmp = 0.918938533204673 + (y * (x - 0.5));
} else {
tmp = 0.918938533204673 + (x * (y + -1.0));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-0.35d0)) .or. (.not. (y <= 44.0d0))) then
tmp = 0.918938533204673d0 + (y * (x - 0.5d0))
else
tmp = 0.918938533204673d0 + (x * (y + (-1.0d0)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -0.35) || !(y <= 44.0)) {
tmp = 0.918938533204673 + (y * (x - 0.5));
} else {
tmp = 0.918938533204673 + (x * (y + -1.0));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -0.35) or not (y <= 44.0): tmp = 0.918938533204673 + (y * (x - 0.5)) else: tmp = 0.918938533204673 + (x * (y + -1.0)) return tmp
function code(x, y) tmp = 0.0 if ((y <= -0.35) || !(y <= 44.0)) tmp = Float64(0.918938533204673 + Float64(y * Float64(x - 0.5))); else tmp = Float64(0.918938533204673 + Float64(x * Float64(y + -1.0))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -0.35) || ~((y <= 44.0))) tmp = 0.918938533204673 + (y * (x - 0.5)); else tmp = 0.918938533204673 + (x * (y + -1.0)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -0.35], N[Not[LessEqual[y, 44.0]], $MachinePrecision]], N[(0.918938533204673 + N[(y * N[(x - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 + N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.35 \lor \neg \left(y \leq 44\right):\\
\;\;\;\;0.918938533204673 + y \cdot \left(x - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 + x \cdot \left(y + -1\right)\\
\end{array}
\end{array}
if y < -0.34999999999999998 or 44 < 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--100.0%
unsub-neg100.0%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
if -0.34999999999999998 < y < 44Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 98.9%
neg-mul-198.9%
sub-neg98.9%
Simplified98.9%
Final simplification99.5%
(FPCore (x y) :precision binary64 (if (or (<= y -59000.0) (not (<= y 32000.0))) (* y (- x 0.5)) (+ 0.918938533204673 (* x (+ y -1.0)))))
double code(double x, double y) {
double tmp;
if ((y <= -59000.0) || !(y <= 32000.0)) {
tmp = y * (x - 0.5);
} else {
tmp = 0.918938533204673 + (x * (y + -1.0));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-59000.0d0)) .or. (.not. (y <= 32000.0d0))) then
tmp = y * (x - 0.5d0)
else
tmp = 0.918938533204673d0 + (x * (y + (-1.0d0)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -59000.0) || !(y <= 32000.0)) {
tmp = y * (x - 0.5);
} else {
tmp = 0.918938533204673 + (x * (y + -1.0));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -59000.0) or not (y <= 32000.0): tmp = y * (x - 0.5) else: tmp = 0.918938533204673 + (x * (y + -1.0)) return tmp
function code(x, y) tmp = 0.0 if ((y <= -59000.0) || !(y <= 32000.0)) tmp = Float64(y * Float64(x - 0.5)); else tmp = Float64(0.918938533204673 + Float64(x * Float64(y + -1.0))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -59000.0) || ~((y <= 32000.0))) tmp = y * (x - 0.5); else tmp = 0.918938533204673 + (x * (y + -1.0)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -59000.0], N[Not[LessEqual[y, 32000.0]], $MachinePrecision]], N[(y * N[(x - 0.5), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 + N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -59000 \lor \neg \left(y \leq 32000\right):\\
\;\;\;\;y \cdot \left(x - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 + x \cdot \left(y + -1\right)\\
\end{array}
\end{array}
if y < -59000 or 32000 < 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--100.0%
unsub-neg100.0%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in y around inf 98.3%
if -59000 < y < 32000Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 98.9%
neg-mul-198.9%
sub-neg98.9%
Simplified98.9%
Final simplification98.6%
(FPCore (x y)
:precision binary64
(if (<= y -0.0017)
(+ (* x y) (- 0.918938533204673 (* y 0.5)))
(if (<= y 56.0)
(+ 0.918938533204673 (* x (+ y -1.0)))
(+ 0.918938533204673 (* y (- x 0.5))))))
double code(double x, double y) {
double tmp;
if (y <= -0.0017) {
tmp = (x * y) + (0.918938533204673 - (y * 0.5));
} else if (y <= 56.0) {
tmp = 0.918938533204673 + (x * (y + -1.0));
} else {
tmp = 0.918938533204673 + (y * (x - 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.0017d0)) then
tmp = (x * y) + (0.918938533204673d0 - (y * 0.5d0))
else if (y <= 56.0d0) then
tmp = 0.918938533204673d0 + (x * (y + (-1.0d0)))
else
tmp = 0.918938533204673d0 + (y * (x - 0.5d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -0.0017) {
tmp = (x * y) + (0.918938533204673 - (y * 0.5));
} else if (y <= 56.0) {
tmp = 0.918938533204673 + (x * (y + -1.0));
} else {
tmp = 0.918938533204673 + (y * (x - 0.5));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -0.0017: tmp = (x * y) + (0.918938533204673 - (y * 0.5)) elif y <= 56.0: tmp = 0.918938533204673 + (x * (y + -1.0)) else: tmp = 0.918938533204673 + (y * (x - 0.5)) return tmp
function code(x, y) tmp = 0.0 if (y <= -0.0017) tmp = Float64(Float64(x * y) + Float64(0.918938533204673 - Float64(y * 0.5))); elseif (y <= 56.0) tmp = Float64(0.918938533204673 + Float64(x * Float64(y + -1.0))); else tmp = Float64(0.918938533204673 + Float64(y * Float64(x - 0.5))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -0.0017) tmp = (x * y) + (0.918938533204673 - (y * 0.5)); elseif (y <= 56.0) tmp = 0.918938533204673 + (x * (y + -1.0)); else tmp = 0.918938533204673 + (y * (x - 0.5)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -0.0017], N[(N[(x * y), $MachinePrecision] + N[(0.918938533204673 - N[(y * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 56.0], N[(0.918938533204673 + N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 + N[(y * N[(x - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.0017:\\
\;\;\;\;x \cdot y + \left(0.918938533204673 - y \cdot 0.5\right)\\
\mathbf{elif}\;y \leq 56:\\
\;\;\;\;0.918938533204673 + x \cdot \left(y + -1\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 + y \cdot \left(x - 0.5\right)\\
\end{array}
\end{array}
if y < -0.00169999999999999991Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
*-commutative100.0%
Simplified100.0%
if -0.00169999999999999991 < y < 56Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 98.9%
neg-mul-198.9%
sub-neg98.9%
Simplified98.9%
if 56 < 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--100.0%
unsub-neg100.0%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
Final simplification99.5%
(FPCore (x y) :precision binary64 (if (or (<= y -1.35) (not (<= y 1.6))) (* y (- x 0.5)) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -1.35) || !(y <= 1.6)) {
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.6d0))) 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.6)) {
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.6): 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.6)) 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.6))) 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.6]], $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.6\right):\\
\;\;\;\;y \cdot \left(x - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\
\end{array}
\end{array}
if y < -1.3500000000000001 or 1.6000000000000001 < 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--100.0%
unsub-neg100.0%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in y around inf 97.8%
if -1.3500000000000001 < y < 1.6000000000000001Initial program 100.0%
fmm-def100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 98.1%
neg-mul-198.1%
sub-neg98.1%
Simplified98.1%
Final simplification97.9%
(FPCore (x y) :precision binary64 (if (or (<= x -9000000.0) (not (<= x 2750.0))) (- x) 0.918938533204673))
double code(double x, double y) {
double tmp;
if ((x <= -9000000.0) || !(x <= 2750.0)) {
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 <= (-9000000.0d0)) .or. (.not. (x <= 2750.0d0))) 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 <= -9000000.0) || !(x <= 2750.0)) {
tmp = -x;
} else {
tmp = 0.918938533204673;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -9000000.0) or not (x <= 2750.0): tmp = -x else: tmp = 0.918938533204673 return tmp
function code(x, y) tmp = 0.0 if ((x <= -9000000.0) || !(x <= 2750.0)) tmp = Float64(-x); else tmp = 0.918938533204673; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -9000000.0) || ~((x <= 2750.0))) tmp = -x; else tmp = 0.918938533204673; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -9000000.0], N[Not[LessEqual[x, 2750.0]], $MachinePrecision]], (-x), 0.918938533204673]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9000000 \lor \neg \left(x \leq 2750\right):\\
\;\;\;\;-x\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673\\
\end{array}
\end{array}
if x < -9e6 or 2750 < x Initial program 100.0%
fmm-def100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 55.4%
neg-mul-155.4%
sub-neg55.4%
Simplified55.4%
Taylor expanded in x around inf 54.6%
neg-mul-154.6%
Simplified54.6%
if -9e6 < x < 2750Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around inf 98.9%
Taylor expanded in y around 0 41.2%
Final simplification47.2%
(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%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
(FPCore (x y) :precision binary64 0.918938533204673)
double code(double x, double y) {
return 0.918938533204673;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 0.918938533204673d0
end function
public static double code(double x, double y) {
return 0.918938533204673;
}
def code(x, y): return 0.918938533204673
function code(x, y) return 0.918938533204673 end
function tmp = code(x, y) tmp = 0.918938533204673; end
code[x_, y_] := 0.918938533204673
\begin{array}{l}
\\
0.918938533204673
\end{array}
Initial program 100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+r+100.0%
cancel-sign-sub-inv100.0%
associate-+l-100.0%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
associate--r+100.0%
distribute-lft-out--100.0%
unsub-neg100.0%
fmm-def100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around inf 75.4%
Taylor expanded in y around 0 23.9%
herbie shell --seed 2024177
(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))