"nan" v. try-catch for arithmetic

J. Landman Gay jacque at hyperactivesw.com
Tue Jun 24 17:32:51 EDT 2014


On 6/24/2014, 1:02 PM, Graham Samuel wrote:
> I get a result, "nan", and the catch doesn't fire. Why not? Maybe
> someone can explain what the engine is doing here - or is it just an
> obscure bug?

A "catch" only triggers when there is a script error. In this case there 
is no error, "nan" is a legitimate value for a calculation that can't be 
computed.

You may have to change to an "if" statement to check for any 
non-numerical value, which would also include "nan".

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the use-livecode mailing list