C cuts off the fractional part of the real value, converts the remaining part to int, and stores the result in 2's complement binary form in the memory cell for the variable. For instance, the statement
n = 6/4.0
takes the real value (6/4.0, which is 1.5), cuts off the 0.5 to give 1.0, converts this to 1 (without a decimal point meaning it us in 2's complement binary form), and stores this in memory cell for the variable n.
No comments:
Post a Comment