Re: strange rounding result
- To: mathgroup at smc.vnet.net
- Subject: [mg80967] Re: [mg80918] strange rounding result
- From: Syd Geraghty <sydgeraghty at mac.com>
- Date: Thu, 6 Sep 2007 05:34:37 -0400 (EDT)
- References: <200709050659.CAA27251@smc.vnet.net>
Chris... This appears to be a bug in Round. I tried:- In[27]:= Round[9.995, 1/100] Round[%] Out[27]= 999/100 Out[28]= 10 In[26]:= Round[999/100] Out[26]= 10 So the Round of the "interim" result gave the expected integer result. Cheers ... Syd On Sep 4, 2007, at 11:59 PM, Chris Chiasson wrote: > Round[9995,10] > Round[999.5,1] > Round[99.95,1/10] > Round[9.995,1/100] > Round[.9995,1/1000] > > The results of these commands are decreasing powers of ten, except the > second to last one, which gives 999/100 on my machine. I assume it has > something to do with the storage of floating point numbers in binary > rather than decimal form, but I don't know. Anyway, it just seemed > strange to me and I wanted to point it out. > > Maybe it has something to do with the "round to even" behavior? Meh. > > -- > http://chris.chiasson.name/ >
- References:
- strange rounding result
- From: "Chris Chiasson" <chris@chiasson.name>
- strange rounding result