Troubles with inequality

J. Landman Gay jacque at hyperactivesw.com
Wed Feb 4 23:42:27 CET 2015


On 2/4/2015 3:01 PM, Graham Samuel wrote:
> Fascinating! Up to this moment, it seemed to me that the
> **appearance** of a number in a variable or more particularly in a
> field, **is** the number - where is the space where the engine can
> put an extended value?

The number retains its full value as long as it remains in RAM. The 
numberformat only works when an operation is performed on it that 
converts it to a string. So, placing it into a field will cause it to 
become the visible representation of the number if you pull it back out 
of the field again later. Putting the number into a variable frequently 
turns it into a string unless the engine determines the variable is 
actually a number and retains it as such.

put "12.5" into tVar -- still a number
add 2 to tVar -- still a number
put tVar into fld 1 -- tVar remains a number, field contains a string
put "x" after tVar -- now it's a string

Numberformat does only change the representation of the number, but is 
only applied when something turns that number into a string.

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 here, field contains a 
string "2.56"
add 1 to tVar -- still a number, contains 3.55555


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



More information about the use-livecode mailing list