## Module (chicken fixnum)

Because CHICKEN supports a full numeric tower, operations can sometimes incur a substantial overhead to simply detect the type of numbers you're passing in. When you know you're definitely dealing only with fixnums, you can choose to use fixnum-specific operations to avoid this overhead.

This is purely a performance hack. You might want to consider adding type annotations instead, this often gives the same performance boost without having to rewrite all numeric operators in your code.

### Arithmetic fixnum operations

fx+ N1 N2procedure
fx- N1 N2procedure
fx* N1 N2procedure
fx/ N1 N2procedure
fxmod N1 N2procedure
fxrem N1 N2procedure
fxneg Nprocedure
fxmin N1 N2procedure
fxmax N1 N2procedure
fxand N1 N2procedure
fxior N1 N2procedure
fxxor N1 N2procedure
fxnot Nprocedure
fxshl N1 N2procedure
fxshr N1 N2procedure
fxgcd N1 N2procedure

  `fx+` and friends are arithmetic fixnum operations. These procedures do not check their arguments, so non-fixnum parameters will result in incorrect results. `fxneg` negates its argument.

  On division by zero, `fx/`, `fxmod` and `fxrem` signal a condition of kind `(exn arithmetic)`.

  `fxshl` and `fxshr` perform arithmetic shift left and right, respectively.

### Overflow-aware fixnum operations

fx+? N1 N2procedure
fx-? N1 N2procedure
fx*? N1 N2procedure
fx/? N1 N2procedure

  These procedures behave similarly to their standard counterparts with the exception that `#f` is returned if an argument is not a fixnum or the result of the operation overflows.

  Chaining of such procedures is well-defined and causes the overflow error to be propagated.

### Fixnum comparison and predicates

fxodd? Nprocedure
fxeven? Nprocedure
fx= N1 N2procedure
fx> N1 N2procedure
fx< N1 N2procedure
fx>= N1 N2procedure
fx<= N1 N2procedure

  Comparison of fixnums and predicates on them.

### Fixnum limits

most-positive-fixnumconstant
most-negative-fixnumconstant
fixnum-bitsconstant
fixnum-precisionconstant

  Platform-specific fixnum limits.

Previous: Module (chicken file posix)

Next: Module (chicken flonum)