Log in

No account? Create an account
Wizard question - dmv/blogs/lj — LiveJournal

> Recent Entries
> Archive
> Friends
> Profile
> dmv/index


Alt. Info Streams
Flickr Stream

August 7th, 2002

Previous Entry Share Next Entry
01:43 pm - Wizard question
In C++

Our floating point library needs a value for inf and -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?

(12 comments | Leave a comment)


[User Picture]
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).

[User Picture]
Date:August 7th, 2002 07:52 pm (UTC)
I thought that the perfect compiler would reduce all non-terminating, non-side-effectful programs into a single goto statement, not into nothing.
[User Picture]
Date:August 7th, 2002 07:54 pm (UTC)
Point, ssaicps.

> Go to Top