Singles to Doubles



Hi Folks --

Not sure I ever noticed this before, as I really haven't used Singles "forever"
(thinking back to DOS days) now. But when I needed to convert a whole boatload of
Single values to Doubles this morning, I noted some really funky conversions. For
example, try this in the Immediate window, with virtually any random number you care
to:

s=0.564!:?cdbl(s),cdbl(cstr(s))
0.564000010490417 0.564
s=0.3026!:?cdbl(s),cdbl(cstr(s))
0.302599996328354 0.3026

What the heck? Seems silly to have to convert it to a String first, then to a
Double. But, it is more accurate. Anyone know of a less ugly way to accurately
replicate a Single with a Double, or this the best it gets?

Thanks... Karl
--
..NET: It's About Trust!
http://vfred.mvps.org


.



Relevant Pages