CASE construct, but with reals

CASE construct, but with reals

Apparently I can't use a REAL variable as the case expression in a CASE consruct. Is there any similar construct in which I can do effectively the same thing using a REAL, or am I relegated to a series of IF ... THENs?

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Nope - can't use REALs. Keep in mind that comparing REALs for equality is often a source of trouble, as sometimes a computed result isn't exactly the decimal value you think it is. Depending on what your values are, perhaps you could convert the value to integer and CASE on that?


Retired 12/31/2016

Thanks, anyway. Yes, I am familiar with the hazards of comparing reals.

Now I just have to decide which is uglier, the IF..THENs, or the conversion to an INTEGER case expression.

Leave a Comment

Please sign in to add a comment. Not a member? Join today