Re: Floating-Point
- Posted by Lewis Townsend <keroltarr at HOTMAIL.COM> Mar 20, 2000
- 431 views
Hello Robert, Thanks for the info. I understand the problem very well now. >1. floating-point calculations are not always exact, and a tiny > error in a calculation can be magnified into a huge error. > floor(0.99999) is 0, as is floor(0.9999999999... trillion places) > It is your responsibility as a programmer to properly handle > these situations. I for one would almost rather recieve an error or a warning than allow subscripts be non-integers. Or perhaps the subscript error could have showed the original value instead of the floored result. This would help me to "properly handle these situations" by letting me know when they occur. Are you suggesting that we round everything to make sure this doesn't sneak up on us. >5. By default, Euphoria prints numbers rounded to 10 > significant digits. This is an arbitrary cutoff point that was > chosen so as to not cause undue eyestrain or clutter. > If you want to see more digits, use printf(1, "%.16e", x). My main confusion was that when I print()ed the results of the expressions it said 1 instead of .9999999999. Is that because of the 10 digit cutoff? Sure, I know, I didn't use printf() to get lots of decimal places but print() ROUNDED UP (to the nearest integer)! If print can do this, why can't the subscript mechanism? Would it slow things down? Sorry if this sounds like I'm whining. I'm just looking for more information. later, Lewis Townsend keroltarr at hotmail.com http://geocities.com/keroltarr/ ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com