Troubles with inequality

dunbarx at aol.com dunbarx at aol.com
Wed Feb 4 11:36:31 EST 2015


Graham.


You might consider using the "round" function, with its precision set to whatever decimal value you wish, likely that value that you used to consider setting the numberformat. This will do almost the same thing, and trunc at that level, which is what I believe you thought the numberformat did. "Almost", because note that the rounding at that level may introduce a complication for you. 




Craig Newman



on mouseUp
   put 1.234567 into temp
   put 1.2345678 into aa
   set the numberFormat to "0.###"
   put temp * 1 into temp
   put aa * 1 into aa
   answer aa = temp
   answer word 1 of aa = word 1 of temp
   answer word 1 of aa
end mouseUp





-----Original Message-----
From: Colin Holgate <coiin at verizon.net>
To: How to use LiveCode <use-livecode at lists.runrev.com>
Sent: Wed, Feb 4, 2015 10:16 am
Subject: Re: Troubles with inequality


The numberformat only affect the appearance of the number, not its value. If you 
want to compare them based on the appearance characters, you can compare them as 
strings instead of numbers. Try this:

on mouseUp
   put 1.234567 into temp
   put 1.2345678 into aa
   set the numberFormat to "0.###"
   put temp * 1 into temp
   put aa * 1 into aa
   answer aa = temp
   answer word 1 of aa = word 1 of temp
   answer word 1 of aa
end mouseUp


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

 




More information about the use-livecode mailing list