lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


2014-05-17 8:31 GMT+02:00 Philipp Janda <siffiejoe@gmx.net>:
> Btw., does anyone know who invented integer division as defined in C in the
> first place? Is it used outside of programming?

It was already that way in Fortran I, because early computers worked that
way.

The IBM 1620, for example, had 6-bit bytes configured as individually
addressable decimal digits (four bits), leaving a flag bit and a parity bit.
Arithmetic had unrestricted operand lengths, end-of-field being tagged by
the flag.

Say you divided a 67-digit dividend by a 22-digit divisor. The operation
would replace the dividend by a 45-digit quotient and a 22-digit remainder.
The Fortran division operation when given integer operands (by default,
those whose names start with I,J,K,L,M,N) would return the quotient only.
Its address would be the same is that of the dividend, since the quotient
replaced the dividend digit-by-digit as the the long division algorithm
proceeded, with a flag being put in when the algorithm stops.

Floating-point was done by software for machines like the 1620.
You had to put in decimal points or E explicitly to make floating-point
literals. With Lua 5.3, we are reverting to this practice.

Yes, Lua stands on the shoulders of giants :-)