# to the nth power

Richard A. O'Keefe ok at goanna.cs.rmit.oz.au
Mon Nov 12 18:31:43 AEST 1990


In article <14427 at smoke.brl.mil>, gwyn at smoke.brl.mil (Doug Gwyn) writes:
: In article <4239 at goanna.cs.rmit.oz.au> ok at goanna.cs.rmit.oz.au (Richard A. O'Keefe) writes:
: >Does anyone know why C hasn't got a round() function and why ANSI
: >failed to add one?
: 
: Because it is trivial to roll your own:
: #define	Round( d )	floor( (d) + 0.5 )	/* requires <math.h> */
: and because there was no established existing practice (e.g. the library
: Base Document did not specify such a function).

I'm afraid it's not that trivial.  That doesn't provide the preferred
round-to-even-when-there-is-a-tie.  It is a _pain_ that the function
nint() isn't portable.  The Base Document didn't specify fsetpos() either,
but that didn't stop ANSI filling in a nasty gap.

What's the NCEWG up to?  Are they likely to address this?
-- 
The problem about real life is that moving one's knight to QB3
may always be replied to with a lob across the net.  --Alasdair Macintyre.



More information about the Comp.lang.c mailing list