Most functions in PCC that operate on numbers do not care whether the numbers are integral or fractional; those are documented as taking a Num. However, some operations are only sensible on integers. Those are documented as taking type Int, and will refuse to work with fractional numbers. Bools automatically convert to integers, where True converts to 1, False to 0.

If you have a fractional number, you can use Int or Round to convert it to an integer.

In general, the result of an operation involving fractional numbers is again a fractional number, whereas the result of an operation involving integers can be an integer if possible.

PCC 1.x and PCC2 track a value's type very closely, thus 2.5*2 is a fractional number because it started out with one. PCC2 Web relaxes these rules a little, and looks at the actual values. In PCC2 Web, 2.5*2 is a valid integer.

Commands and Functions taking Int as Parameter

Functions returning Int

Properties of type Int