In Smalltalk numbers are objects of class NSNumber (9.2), but nevertheless, we can do calculation with them. The common operators acting on them are available.
Example:
|
nOne := 1.
" implicit creation "
nTwo := 3.75 * 28. nThree := nOne - nTwo.
cosA := 33.0 cos.
" cosine of angle (degrees) "
phi := cosA acos.
" arccosine returns angle (radiants) "
|
Note: The operators must be surrounded with spaces. The interpreter will not correctly recognise them otherwise.
Other mathematical functions available: sin, asin, tan, atan, sqrt, exp, log.