NaN() overriding


Recommended Posts

So, I have a number of locations where I have fractions for example

"O2_Mass_Flow/Steam_Mass_Flow"

And a number of times this evaluates to NaN or "-1.$" (or something like that).

I would basically like a method of when NaN is calculated, it returns "0" instead.

I tried the following in conversions:

(a) "(O2_Mass_Flow/Steam_Mass_Flow)*(O2_Mass_Flow/Steam_Mass_Flow != NaN())"

So when the fraction equates to NaN, it the boolean returns a "0".

(:) "iif(O2_Mass_Flow || Steam_Mass_Flow == 0, 0, O2_Mass_Flow/Steam_Mass_Flow)"

I gather Nan() is a function and so may not be able to be used in conversions, but you get my jist.

Thanks,

Dan

Link to comment
Share on other sites

NaN() is a function. NaN is basically defined in DF as any value > 1e300. Its easier to deal with than a true floating point NaN. I like your second method (B). You're going to get NaN when you divide by 0, so just check before you divide. Did it not work? There is no reason to check O2_Mass_Flow.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.