Re : [ng-spice-devel] ACS with the "free" Borland compiler


To ng-spice-frontends@ieee.ing.uniroma1.it
From "Glao dezai" <glao@univ-paris12.fr>
Date Tue, 27 Mar 2001 16:21:18 -0000
Delivered-To mailing list ng-spice-frontends@ieee.ing.uniroma1.it
In-Reply-To <200103260936.BAA07545@grfx.com>
Mailing-List contact ng-spice-frontends-help@ieee.ing.uniroma1.it; run by ezmlm
Reply-To ng-spice-frontends@ieee.ing.uniroma1.it
User-Agent eGroups-EW/0.82

--- Dans ng-spice@e..., ng-spice-frontends@i... a écrit
>
> ACS is indeed compiling now, but I'm getting floating
> point errors in that nmos100 circuit. Still investigating.
>
> On that subject, I'm finding that my own version of spice
> will handle that circuit ok on my PIII desktop machine
> running WinME, but not on my Celeron with Win98. Again,
> still investigating.
>
> On the rint() function, one manual I found on the web says ->
>
> -----------------------------------------------------------
>
> rint(), rintf()
>
> Round to the nearest integral value
>
> Synopsis:
>
> #include <math.h>
>
> double rint ( double x );
>
> float rintf ( float x );
>
> Library:
>
> libm.so
>
> Description:
>
> The rint() and rintf() functions return the integral value nearest x
in the
> direction of the current rounding mode.
>
> If the current rounding mode rounds toward negative infinity, then
rint() is
> identical to floor(). If the current rounding mode rounds toward
positive
> infinity, then rint() is identical to ceil().
>
> Returns:
>
> An integer (represented as a double precision number) nearest x in
the
> direction of the current rounding mode (IEEE754).
>
> -----------------------------------------------------------
>
> Whereas another one says ->
>
> -----------------------------------------------------------
>
> RINT(3)             Linux Programmer's Manual             RINT(3)
>
> NAME
>        rint - round to closest integer
>
> SYNOPSIS
>        #include <math.h>
>
>        double rint(double x);
>
> DESCRIPTION
>        The rint() function rounds x to an integer value according
>        to the prevalent rounding mode.  The default rounding mode
>        is to round to the nearest integer.
>
> RETURN VALUE
>        The  rint() function returns the integer value as a float-
>        ing-point number.
>
> CONFORMING TO
>        BSD 4.3
>
> SEE ALSO
>        abs(3), ceil(3), fabs(3), floor(3), labs(3)
>
> ------------------------------------------------------------
>
> Is the first one a "missprint" ? That is, do they mean that
> the current rounding mode applies when the fractional part
> is exactly 0.5 ?
>
> Al, what are you expecting rint() to give you ? How exactly
> do you set the current rounding mode ?
>
> Isn't C lovely for portability ;-(
>
> Cheers,
>
> Alan


Hi Alan
I have already discussed with al about this problem when attemting to
compile ACS under Microsoft Visual C++

I wrote this in l_denoise.h


#ifdef  _MSC_VER
/*
     The rint() function rounds x to an integer value according
       to the prevalent rounding mode.  The default rounding mode
       is to round to the nearest integer.

RETURN VALUE
       The  rint() function returns the integer value as a float­
       ing-point number.
*/
inline double rint(double x)
{
        return floor(x+.5);
}
#endif


Cheers
D.G.



Partial thread listing: