HP Forums
Not a Number NaN - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Not a Number NaN (/thread-4877.html)

Not a Number NaN - Powersoft - 10-04-2015 05:38 PM

Hi all,

Is it posible to give back in a subroutine the expression (value?) NaN



RE: Not a Number NaN - cyrille de brébisson - 10-05-2015 07:02 AM


In PPL, in theory, no.

The only way to generate a NaN on Prime is through the CAS. So you could generate a NaN using the CAS, store that in a variable (CAS or home) and then return that variable from your function.
Be careful of the difference between undef and NaN... undef IS NaN in CAS, but if moved to home, it becomes just a 'variable name'. Which means that it will NOT behave in the same way if you start doing calculations with it.

You want to make sure that, even in home, NaN+1=NaN (for example).

They might be some other way to do it, but this is the first one the jumps to mind.