Subject: Re: Converting long double to integer types
To: None <port-sparc64@NetBSD.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: port-sparc64
Date: 11/05/2007 10:33:09
> On 4.99.30, the following code spits out "x=2 y=1":

> 	long double ld = 1.9;
> 	int x = ld;
> 	int y = (double)ld;

> AFAICS, "x=2" clearly violates the standard, no?

Which standard?  IEEE?  I think that depends on what the default
rounding mode is; round-to-nearest will give 2.  (Though I'm not sure
whether the IEEE FP spec has anything to say about whether double and
long double may default to rounding in different directions.)

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B