7.2.38 integer - Do Arithmetic in Integer Instead of Doubleuse integer; $x = 10/3; # $x is now 3, not 3.33333333333333333 This module tells the compiler to use integer operations from here to the end of the enclosing block. On many machines, this doesn't matter a great deal for most computations, but on those without floating point hardware, it can make a big difference. This pragma does not automatically cast everything to an integer; it only forces integer operations on arithmetic. For example: use integer; print sin(3); # 0.141120008059867 print sin(3) + 4; # 4
You can turn off the integer pragma within an inner block by using the
|
|