-
Notifications
You must be signed in to change notification settings - Fork 306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The solution to 2.84 seems to have a problem #1
Comments
I think we get the same goal with different expressions. |
This solution doesn't handle zeros. x = 000..00 and y = 100..00 |
@zagortenay333 did you mean +0 and -0? This function named |
Yes, but it won't return true when x=+0 and y=-0 since |
Yes, you are right. Any elegant way to solve this? |
return
!(ux<<1 || uy<<1) || /* both zero */
(sx > sy) || /* x < 0 and y >= 0 */
(!sx && !sy && ux <= uy) || /* x >= 0 and y >= 0 */
(sx && sx && ux >= uy); /* x < 0 and y < 0 */ |
thanks @LittleCoke @zagortenay333 , how do you think 9d75393 |
Thank you!! |
maybe need use assert(float_le(-0.0, +0.0));
assert(float_le(+0.0, -0.0)); to generate negative zero known from this. maybe also can use |
我已收到您的邮件
|
I think you should not simply judge ux uy by comparing sx==sy. I think maybe the link is a proper answer.
https://github.com/mofaph/csapp/blob/master/exercise/ex2-83.c
The text was updated successfully, but these errors were encountered: