Re: question about the function 'round' in rep



Hi. 

On Mon, 31 Aug 2009 12:28:56 -0700 (PDT), cheneymx wrote:
> in elisp:        (round 2.3) -> 2
> but in rep:    (round 2.3) -> 2.

In C, round returns double. 1e+100 overflows to be an integer. So not
as absurd as it seems.

On Wed, 2 Sep 2009 22:10:54 +0300, Timo Korvola wrote:
> In general numerical functions, including floor, ceiling, truncate and 
> round, return inexact results if any of the arguments are inexact, so 
> (round 2.3) returns an inexact 2 while (round 23/10) returns an exact 2.  
> And (round 1e+42) return 1e+42 regardless of bignum support.

On Tue, 1 Sep 2009 14:19:37 -0400, Nathan Froyd wrote:
> the documentation for ROUND suggests that it really does return an
> integer, not a floating-point number that represents an integer.

Librep manual on number is updated in 0.17.4, and as Chris wrote, the
return type depends on if it is compiled with gmp or not. It is
written. I think it's worth browsing new one.

In debian, it seems librep is compiled against gmp, but in Gentoo,
it's user option. So sawfish can't assume anything right now.
(Of course it's possible to force gmp in librep >= 1.0, and 
sawfish-xxx depends on librep-1.0, but we don't have any plan now.)

It's me who did the doc rewrite, but the text is not clear cut
yet. I'm sorry for that, but give me a break, the *implementation* is
confusing.

> It's quite confusing for INTEGERP to return T for (ROUND 2.3)


I negelected this point (sorry again). But don't blame me. Internally,
there're INTP and INTEGERP (in src/rep_lisp.h). Dunno what they
precisely mean. I don't like to draw the complete picture of number in
rep. I negelect this time again :-( Anyway, Once you know the basic,
you rarely need integerp.

# So don't hesitate to ask. It's the only way out.

Whining,
Teika (Teika kazura)



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