Hi Graham,

If I execute (-8)^(2/3) in LiveCode 6.6.1, I get "execution error at line 7 (pow: range error (overflow)), char 17", i.e. an execution error instead of NaN.

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Installer Maker for LiveCode:
http://qery.us/468

Buy my new book "Programming LiveCode for the Real Beginner" http://qery.us/3fi

LiveCode on Facebook:
https://www.facebook.com/groups/runrev/

On 6/24/2014 20:02, Graham Samuel wrote:
Hi

I have a bit of code that looks for input errors where the user is supposed to 
write an arithmetic expression into a field. The relevant fragment looks like 
this

  try
   put value(fld "myField") into testResult
  catch
   answer "oops, that's not a valid real number. Try again"
   exit mouseUp
  end try
  ...

Now I input a legitimate expression like 3+sin(pi/2)

  the catch doesn't fire, as expected. If I put in something which isn't a 
well-formed expression, like

  ardvaark + 92

it does fire, as expected. If I put

  sqrt(-1)

that fires too. But if I put

  (-8)^(2/3)

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?

TIA

Graham



_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to