August 7th, 2002
|01:43 pm - Wizard question|
Our floating point library needs a value for
-inf. Presently, this was done by
min_real_val = -1.0 / 0.0;
and the obvious counter to that. This causes the compiler (our compiler, even) to complain... but it works (I believe). Is there a better way to get these values?
I'm not convinced that infinity is an integer.
Of course its not. Its a float.
|Date:||August 7th, 2002 07:19 pm (UTC)|| |
I'm not convinced (0==0) is the proper conditional. If one wanted to take this approach, (inf >= 0) might make sense. Otherwise, I fear 0==0 would have some kind of run-in with Mr. C. Propagation and the Dead Code Eliminator (a plausible bandname).
I've participated in arguments over whether code optimizers should remove infinite loops or not. I think that this doesn't actually work with finite precision floating point numbers anyways. Eventually it will just stop increasing. So really you need to double it every time to get that overflow you crave. Or is overflow different than infinity? Hopefully.
|Date:||August 7th, 2002 07:40 pm (UTC)|| |
Well, in the perfect compiler (see 'full employment theory for compiler writers'
) they would be.
I believe that, yes, inf is not just overflow. But it is pretty close. And raises interesting questions of what 'inf'++ means, or 'inf'--.
As I posted already, there are fixed values (and I believe NaN surrounds them).
I thought that the perfect compiler would reduce all non-terminating, non-side-effectful programs into a single goto statement, not into nothing.
|Date:||August 7th, 2002 07:54 pm (UTC)|| |