newLISP Fan Club

Forum => Anything else we might add? => Topic started by: ssqq on August 01, 2016, 01:56:39 AM

Title: -nan is not number
Post by: ssqq on August 01, 2016, 01:56:39 AM
-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.
Title: Re: -nan is not number
Post by: TedWalther on August 02, 2016, 03:03:46 AM
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.
Title: Re: -nan is not number
Post by: rickyboy on August 02, 2016, 05:22:42 AM
Hello ssqq,



This is what you need: //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
Title: Re: -nan is not number
Post by: ssqq on August 02, 2016, 07:40:45 AM
I see, Reason is ANSI C could not support.
Title: Re: -nan is not number
Post by: services on December 21, 2022, 06:46:14 PM
However, there are a great number of issues that arise in the minds of customers while they are in the process of hiring escorts.Pattaya Beach escort sites (//https) Regarding these questions, we have provided further information.