Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
Integer Division Next: Intrinsic Procedures Up: Mixing Objects of Different Previous: Mixed Type Assignment   Integer Division If one integer divides another in a subexpression then type of that subexpression is INTEGER. Confusion often arises about integer division; in short, division of two integers produces an integer result by truncation (towards zero). Consider, REAL a, b, c, d, e a = 1999/1000 b = -1999/1000 c = (1999+1)/1000 d = 1999.0/1000 e = 1999/1000.0 a is (about) 1.000. The integer expression 1999/1000 is evaluated and then truncated towards zero to produce an integral value. Its says in the Fortran 90 standard, [1], P84 section 7.2.1.1, ``The result of such an operation [integer division] is the integer closest to the mathematical quotient and between zero and the mathematical quotient inclusively.'' b is (about) -1.000 for the same reasons as above. c is (about) 2.000 because, due to the parentheses 2000/1000 is calculated. d and e are (about) 1.999 because both RHS's are evaluated to be real numbers, in 1999.0/1000 and 1999/1000.0 the integers are promoted to real numbers before the division. Now try this question Next: Intrinsic Procedures Up: Mixing Objects of Different Previous: Mixed Type Assignment Adam Marshall ©University of Liverpool, 1996 Mon Dec 2 10:59:13 GMT 1996Not for commercial use.