Troubles with inequality

Graham Samuel livfoss at mac.com
Wed Feb 4 18:02:13 EST 2015


Thanks Jacque, a gold mine of information as usual. But it’s pretty obscure, isn’t it? All this started for me because I wanted to test if two numbers were equal, knowing that they probably weren’t exactly equal to the last decimal place but nevertheless were ‘engineering equal’ as it were - say to six places of decimals. So I tried to truncate them to that length and then compare them. More fool me. But now I think I know what should be done, thanks to you - and to everyone else who replied.

Graham


> On 4 Feb 2015, at 23:44, J. Landman Gay <jacque at hyperactivesw.com> wrote:
> 
> On 2/4/2015 3:01 PM, Graham Samuel wrote:
>> So really, if I want an uncomplicated string of characters derived
>> from a number via setting the numberFormat and then doing a
>> calculation, how do I get it?
> 
> You can turn it into a string by putting empty after it:
> 
>  put 1.55555 into tVar -- number
>  set the numberformat to "0.00"
>  add 1 to tVar -- still a number
>  put tVar into fld 1 -- numberformat applied now, field contains a string "2.55"
>  add 1 to tVar -- still a number, contains 3.55555
>  put empty after tVar -- numberformat applies, tVar is a string
> 
> -- 
> Jacqueline Landman Gay         |     jacque at hyperactivesw.com
> HyperActive Software           |     http://www.hyperactivesw.com
> 
> _______________________________________________
> 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