Re: question about the function 'round' in rep



Am Montag, den 31.08.2009, 12:28 -0700 schrieb cheneymx:
> Hello all,
> 
> I get an error, when I execute the following command:
> 
> (move-window-to (input-focus) (round 1200.3) (round 200.4))
> 
> And 
> 
> (move-window-to (input-focus) 1200 200) 
> 
> works correctly. And I found: 
> 
> in elisp:        (round 2.3) -> 2
> but in rep:    (round 2.3) -> 2.
> 
> Is 2. an Integer ?  I checked it by using following command:
> 
> (integerp (round 2.3)) -> t
> 
> So 2. is an integer. But why is my 1st. command wrong?  
> 
> Best regards
> 
> Li

did you compile librep with or without libgmp?

This is the round function (librep/numbers.c), in case you want to
investigate more: 

Round NUMBER downwards to the nearest integer less than or equal to
NUMBER.
::end:: */
{
    rep_DECLARE1 (arg, rep_NUMERICP);
    switch (rep_NUMERIC_TYPE (arg))
    {
    case rep_NUMBER_INT:
    case rep_NUMBER_BIGNUM:
        return arg;

#ifdef HAVE_GMP
    case rep_NUMBER_RATIONAL:
        return rep_make_long_int (floor (mpq_get_d (rep_NUMBER
(arg,q))));
#endif

    case rep_NUMBER_FLOAT:
        return rep_make_float (floor (rep_NUMBER (arg,f)), rep_TRUE);
    }
    abort ();
}

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil



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