Integer

Last updated at 9:04 am UTC on 28 October 2018

I am a common abstract superclass for all Integer implementations. My implementation subclasses are SmallInteger, LargePositiveInteger, and LargeNegativeInteger.

See my Integer superclass for general numeric methods

- arithmetic selectors:
- + - / *
- // (integer quotient) \\ (modulo)
- abs, negated, quo:, reciprocal, rem:

- Comparing
- <, >, =

- mathematical selectors
- sqrt, squared
- ln, log
- gcd, lcm, factorial, take: (combinations taken k at a time)

- trigonometric selectors
- sin, cos, tan
- arcSin, arcCos, arcTan
- degreeCos, degreeSin

- Truncation and rounding
- ceiling, floor
- roundTo:, roundUpTo:, rounded,
- truncateTo:, truncated

- Testing
- odd, even, positive, negative, sign
- isNumber, isNaN, isZero, isDivisibleBy:
- isInteger, isPowerOfTwo

- converting
- asNumber, asPoint, asCharacter, asHexDigit
- degreesToRadians, radiansToDegrees
- @ (special primative for points 1 @ 1)

- Bit manipulation
- << nn, >> nn (bit shifting nn bits)
- bitOr: bitAnd:, bitXor:,bitClear:, bitInvert
- lowBit, highBit

- Intervals (see Interval class)
- to:, to: by:, to: by: do:, to: do:

- enumerating
- timesRepeat:

- Printing
- printOn:, printStringBase:
- asStringWithCommas, asWords, romanString, radix:

Integer division consists of:

/ exact division, answers a fraction if result is not a whole integer

// answers an Integer, rounded towards negative infinity

\\ is modulo rounded towards negative infinity

quo: truncated division, rounded towards zero

Prime numbers demo