Converting numbers to text and back

Dar Scott dsc at swcp.com
Sat Nov 30 03:11:01 EST 2002


On Saturday, November 30, 2002, at 12:10 AM, Ken Ray wrote:

> If you *do* want scientific notation, just change the "f" to "e" and 
> give it
> smaller numbers. For example the following provides for 1 character to 
> the
> left of the decimal and 4 to the right with scientific notation:
>
> on mouseUp
>   put 1/3 into f
>   put empty into field "Report"
>   repeat with theE = -100 to 100
>     put f * 10 ^ theE into x
>     put format("%1.4e",x) & lineFeed after field "Report"
>   end repeat
> end mouseUp
>
> Hope this helps,

Thanks, Ray.

Yeah, format() is what I need.  By smaller numbers, I meant the numbers 
not the numeral length.  I want to represent the value of any number big 
or small in a string so that all the info is there.  The e format is 
just what I need.

I had hoped there was a way in numberFormat since that is what combine 
uses.

It looks as though if I dump an array of numbers I will have to iterate 
through and use format().

Dar




More information about the use-livecode mailing list