[Chapter 7] 7.2.38 integer - Do Arithmetic in Integer Instead of Double
Author: Larry Wall, Tom Christiansen & Randal L. Schwartz
Date: 1999-07-02T02:02:45Z

#

| Chapter 7 The Standard Perl Library |

### 7.2.38 integer - Do Arithmetic in Integer Instead of Double

    use 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 `no integer` directive.

7.2.37 I18N::Collate - Compare 8-bit Scalar Data According to the Current Locale |  | 7.2.39 IPC::Open2 - Open a Process for Both Reading and Writing