Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Equivalent to 'nint' function (missing from math.h)?

478 views
Skip to first unread message

Tim Porter

unread,
Jul 8, 1996, 3:00:00 AM7/8/96
to

I have just installed gcc 2.7.2 and libg++ 2.7.1 on my Sun SPARC system,
under Solaris 2.5.

Our programmers are used to the C and C++ that came with SunOS. Now that
I'm migrating to Solaris I've installed gcc and g++ for them to try out

Some of their programs called a function called 'nint' in math.h. This
converted a value into int format, rounding to the nearest int value
(here's an extract from the man page which explains it better than I can!
:

nint() converts x into int format rounding to the nearest
int value, except halfway cases are rounded to the int value
larger in magnitude. This corresponds to the Fortran gen-
eric intrinsic function nint().


However, the 'nint' function does not seem to exist in the gcc math.h. Is
there an equivalent they should be using? Or should we be using a
different header file??

(Please excuse my ignorance, It's been a long time since I did any
programming and I'm new to gcc and g++ !)


Can anyone please help!

Thanks in advance,

Tim
--
-------------------------------------------------------------------
Tim Porter t.po...@fcrd.gov.uk
Forestry Commission, Research Division
-------------------------------------------------------------------

Andy Barfoot

unread,
Jul 10, 1996, 3:00:00 AM7/10/96
to

In article <4rqlb5$6...@jupiter.fcrd.gov.uk>, por...@fcrd.gov.uk (Tim Porter) writes:
>I have just installed gcc 2.7.2 and libg++ 2.7.1 on my Sun SPARC system,
>under Solaris 2.5.

...


>However, the 'nint' function does not seem to exist in the gcc math.h. Is
>there an equivalent they should be using? Or should we be using a
>different header file??
>
>

> Tim


try "man nint" to see what file needs to be included, and what libraries
specified..

on my solaris system, i #include <sunmath.h> and compile with
cc foo.c -lsunmath -lm

andy

0 new messages