On 10/25/2018 09:40 PM, Joseph Myers wrote:
On Thu, 25 Oct 2018, Rajalakshmi Srinivasaraghavan wrote:
+ if (__builtin_unpack_longdouble (a, 0) < TWO53)
+ {
+ /* In this case the integer portion is completely contained
+ within the high double. So use the hardware convert to
+ integer doubleword, and then extend to int. */
+ l1 = __builtin_unpack_longdouble (a, 0);
+ result = l1;
But if the high double is a positive integer, and the low double is
strictly negative (not -0), you need to subtract 1 to get a result that's
correctly truncated towards zero.
Do you suggest like this?
if (__builtin_unpack_longdouble (a, 0) < TWO53)
{
l1 = __builtin_unpack_longdouble (a, 0);
if (__builtin_unpack_longdouble (a, 1) < 0.0)
result = l1 - 1;
else
result = l1;
}
+ if (__builtin_unpack_longdouble (a, 0) < TWO53)
+ {
+ /* In this case the integer portion is completely contained
+ within the high double. So use the hardware convert to
+ integer doubleword, and then extend to __int128. */
+ l1 = __builtin_unpack_longdouble (a, 0);
+ result = l1;
Likewise here.
--
Thanks
Rajalakshmi S