-nan is not number

Started by ssqq, August 01, 2016, 01:56:39 AM

Previous topic - Next topic

ssqq

-nan (NaN) should not return true with number?



> (set 'nan (sqrt -1))
> (number? nan)
true ;; should return nil


Also advise with inf. I think all NaN and Inf are "error status" that may not throw error immediatly.

So they isn't value.

TedWalther

#1
Quote from: "ssqq"-nan (NaN) should not return true with number?



> (set 'nan (sqrt -1))
> (number? nan)
true ;; should return nil


Also advise with inf. I think all NaN and Inf are "error status" that may not throw error immediatly.

So they isn't value.


Reliably getting nan and inf from the C compiler is not pleasant.  It varies between compilers and architectures and platforms.  The alternative is to write assembly language... which would really require some paid resources to keep track of all the different types of CPU.
Cavemen in bearskins invaded the ivory towers of Artificial Intelligence.  Nine months later, they left with a baby named newLISP.  The women of the ivory towers wept and wailed.  \"Abomination!\" they cried.

rickyboy

#2
Hello ssqq,



This is what you need: http://www.newlisp.org/downloads/newlisp_manual.html#NaNp">//http://www.newlisp.org/downloads/newlisp_manual.html#NaNp.



As a backgrounder, the committee who put together the floating point standard had a reason for admitting things like NaN as floating point "values".  Technically they are "numbers" (FP values, really).



http://grouper.ieee.org/groups/754/faq.html#exceptions">//http://grouper.ieee.org/groups/754/faq.html#exceptions
(λx. x x) (λx. x x)

ssqq

#3
I see, Reason is ANSI C could not support.

services

#4
However, there are a great number of issues that arise in the minds of customers while they are in the process of hiring escorts.https://www.thailandescortshub.com/pattayabeachescorts">Pattaya Beach escort sites Regarding these questions, we have provided further information.