Not exactly.
This should get you started:
function noZ*****rail(pnNumber)
local lnLen, i, lnDummy, lnDecimals, lcDummy
lnDecimals = set("decimals")
set Decimals to 18
if pnNumber%1 # 0
lcDummy = tran(pnNUmber)
lnLen = len(lcDummy)
do while right(lcDummy,1) == "0"
lnLen = lnLen - 1
lcDummy = left(lcDummy,lnLen)
endDo
else
lcDummy = tran(pnNumber)
endIf
set Decimals to (lnDecimals)
return lcDummy
HTH,
Giancarlo
"Dan Freeman" <spam@[EMAIL PROTECTED]
> wrote in message
news:u4ZChggqHHA.4180@[EMAIL PROTECTED]
> ?Transform(Int(value))
>
> Dan
>
> Gene Wirchenko wrote:
>> How do I print a number in simplest form?
>>
>> The numbers I have are specifed to two decimal places, but I do
>> not want trailing 0's or decimal point. (I allow input of two decimal
>> places, but the precision does not need to be printed.)
>>
>> transform(5.30) gives "5.30", and I want "5.3".
>> transform(5.00) gives "5.00", and I want "5".
>>
>> I also do not want any leading spaces. I can ltrim() for that
>> though.
>>
>> I get a surprising result with overprecise constants:
>> n=5.3000
>> ? transform(n) && outputs "5.3000"
>> n=5.30
>> ? transform(n) && outputs "5.30"
>> n=5.00
>> ? transform(n) && outputs "5"
>> I expected "5.00" from the last.
>>
>> What is the easiest way to deal with this?
>>
>> Sincerely,
>>
>> Gene Wirchenko
>>
>> Computerese Irregular Verb Conjugation:
>> I have preferences.
>> You have biases.
>> He/She has prejudices.
>
>


|