On 15-Mar-2000, George Russell <[EMAIL PROTECTED]> wrote:
> Fergus Henderson wrote:
> [snip]
> > For FLOOR_{F->I}(NaN), the result is defined as a NaN:
> [snip]
> > But in both cases this doesn't really make much sense to me,
> > since here the result type of the operation is an integer rather
> > than floating point type.  I guess the earlier part of 6.1 does
> > shed a little extra light:
> 
> The less elevated source of "man floor" tells me that although of
> course floor returns an integer, it returns it represented as a double.
> So perhaps that's the idea.  Or maybe I'm talking rubbish and it
> says explicitly in the standard that FLOOR_{F_I} returns something
> of integer type.

Yes, `FLOOR_{F->I}', which is my Latex-style ASCII-ization
of what appears in the standard as `FLOOR' with a subscript `F->I',
is a function from floating point to integer.  That is the one
which should correspond with Haskell's `floor' function, which
according to the Haskell 98 Report has type

        floor :: (RealFrac a, Integral b) => a -> b

LIA-2 also has a separate floor function named `FLOOR_{F->F}';
this one is a function from floating point to floating point,
and as such corresponds to C's floor() function.

-- 
Fergus Henderson <[EMAIL PROTECTED]>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger [EMAIL PROTECTED]        |     -- the last words of T. S. Garp.

Reply via email to