Re: LONG Re: another one bites the dust
- Posted by Robert Craig <rds at ATTCANADA.NET> Mar 26, 2000
- 561 views
Joel Crook writes: > I attempted to write something in Euphoria that Rob > ultimately said wasn't possible because the > source code (from C -- source below) used C's > "approximations" and that it would not work in Euphoria > because Euphoria "is more accurate." I checked my sent items to you, and I never said what you wanted to do was impossible in Euphoria. I gave you some suggestions on how to do it, using and_bits(), remainder and the like. Nor did I say that Euphoria "is more accurate". I said, and I quote: "In C, calculations that result in a value that is too big for 32-bits, quietly overflow with no compiler or run-time error. Many random number generators take advantage of this fact. In Euphoria, values are automatically converted to 8-byte floating-point format when 4-byte integers are not large enough to hold the result. Euphoria gives you the correct answer. C quietly overflows and gives you the wrong answer. However C programmers are used to this, and they exploit it." There is *no* mathematical algorithm that can be calculated in C++ or any other language that can't be calculated in Euphoria. (This is based on computer science theory from over 50 years ago.) I admit that what you are doing is painful. It's because you are converting code that exploits an idiosyncracy of one language that doesn't exist in the other. Similarly, there are many things that you could write in 5 minutes in Euphoria that would take you 5 hours to convert to C++. > Yet two weeks later > I hear him defend the inaccuracies of floating point atoms > and the Float() function!!! If you are fleeing Euphoria because it uses IEEE binary floating-point, think again. C++ and almost all other languages use the exact same floating-point hardware, and will give you exactly the same problems with 0.1 and with floor(). Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com