Unit 2 - Numbers, Arithmetic, Expression trees Flashcards
A notable exception is Lisp where multiplication can
take any number
of operands (ie it has a mixed arity)
Java automatically inserts integers to float conversions where necessary but *****
does not.
Thus in **, we have to write ** where in Java 2 is sufficient.
Ada
2.0
Haskell does not insert any conversion, but instead it
works out from the context that 2 is a float rather than an integer.
Integer CPU types usually come in two flavours: (and ranges)
singed and unsigned.
An unsigned 8-bit integer, has the range 0 . . . 255.
A signed 8-bit integer type has the range −128 . . . 127.
A floating-point overflow happens only when
the exponent does not fit in the available space.
An overflow upwards (ie for a very large positive number) is
rounded to positive infinity (∞)
an overflow downwards (ie for a very large negative number) is
rounded to negative infinity (−∞).
Positive and negative infinities are
are special values of floating-point types.
A floating-point underflow is a situation where the result of an operation is
so close to 0 that the exponent is a very large negative number.
An underflow usually results in
rounding the number to 0.
This does not happen easily because floating-point types are most accurate near 0.