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

Re: Query about proposed slight change to FIX and FIXR functions (again)



We leave FIX the same, change FIXR to round to nearest rather than adding
0.5 and calling FIX, and add eight new functions(!):
	FLOOR = convert flonum to integer, rounding toward -inf
	CEIL = convert flonum to integer, rounding toward +inf
	TRUNC = convert flonum to integer, rounding toward zero
	ROUND = convert flonum to integer, rounding to nearest integer,
		and to an even integer in the event of a tie.
	FFLOOR, FCEIL, FTRUNC, and FROUND are the same except that their
	result is a flonum rather than an integer.

The first four functions are subject to overflow; however they probably
are not guaranteed always to return a fixnum, rather it is implementation
dependent what is the largest integer they will return, and given a number
larger than that they may overflow.  The second four functions can never
signal an error.

FIX is identical to FLOOR.  FIXR will be changed to be identical to ROUND
(unless there is sentiment for leaving FIXR the way it is).

This proposal is compatible with IEEE standard floating point, which
requires that at least TRUNC, ROUND, FTRUNC, and FROUND exist, and recommends
the others, but does not suggest names for any of the operations.

Since this proposal does not involve any changes to FIX, it will be
upward compatible with Maclisp.  Is there any interest in adding these
other functions to Maclisp?  The DPL people (at least) would use 
(some of) them.