Negative Numbers and NumberFormat

Bob Sneidar bobsneidar at iotecdigital.com
Thu Apr 6 10:51:33 EDT 2017


I've created a monster. All the more reason to depricate numberformat and go with some kind of formatNumber() function like Excel has. I'll have a go today sometime. 

Bob S


> On Apr 5, 2017, at 17:27 , Paul Dupuis via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> On 4/5/2017 7:42 PM, J. Landman Gay via use-livecode wrote:
>> On 4/5/17 5:48 PM, Richard Gaskin via use-livecode wrote:
>>> Jacque wrote:
>>> 
>>>> HyperCard distinguished between "#" and "0" and produced different
>>>> results. It sounds like LC doesn't?
>>> 
>>> Confirmed - running this script in v9dp6 and again all the way back in
>>> v6.0:
>>> 
>>> on mouseUp
>>>   set the numberformat to "###.###"
>>>   put 2.5 + 2.5 into x
>>>   set the numberformat to "000.000"
>>>   put 2.5 + 2.5 into y
>>>   put x &cr& y
>>> end mouseUp
>>> 
>>> ...I get:
>>> 
>>> 005.000
>>> 005.000
> 
> NumberFormat on applies when the number is output or forced to convert
> to a string (for example when doing string concatenation). The variant
> script below:
> 
> on mouseUp
>   set the numberformat to "###.###"
>   put 2.5 + 2.5 into x
>   put x & cr after msg
>   set the numberformat to "000.000"
>   put 2.5 + 2.5 into y
>   put y &cr after msg
> end mouseUp
> 
> results in:
> 
> 005
> 005.000
> 
> In the message box. Just another data point for the discussion.
> 
> 
> 
> 
> _______________________________________________
> 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