srowen commented on PR #44690: URL: https://github.com/apache/spark/pull/44690#issuecomment-1968231292
Well, long * double is always carried out in double precision. Casting it to long doesn't make the math somehow exact. You will always have some truncation when rounding to an integer. I actually can't think of a case where a double is exactly equal to an integer except for powers of two. (When printing a double, it will appear to be equal to an integer and end in ".0" if the double is within 1 ulp of an integer, but it isn't quite) I agree on the issue, I'm saying that simply subtracting 1 ulp (= the smallest double value) would have done the same thing; the longs are a roundabout way of achieving that that I think is misleadingly represented in the comments. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
