Formatting Column of Times
Alex Tweedly
alex at tweedly.net
Wed Sep 7 17:17:06 EDT 2005
Mark Smith wrote:
> See the entry for 'statRound' in the docs...
>
>
Yeah - but I wish there was a way to get this form of rounding in the
format command.
Hmmmm -an enhancement !! I'll request it .... BZ 3111 added
-- Alex.
>
> On 7 Sep 2005, at 19:44, Alex Tweedly wrote:
>
>> Dom wrote:
>>
>>>
>>> another example: to make the sum of a field, and to yield a formatted
>>> result:
>>>
>>> on closefield
>>> put the short name of the target into tfield replace comma with
>>> "." in fld tfield -- european currency delimiter ;-)
>>> put fld tfield into montants
>>> replace return with comma in montants
>>> put "S" & tfield into ttotal
>>> put format("%3.2f",sum(montants)) into fld ttotal
>>> end closefield
>>>
>>>
>> "european currency delimiter" reminds me .... you need to be cautious
>> about using format for currency values.
>>
>> Many countries (e.g. UK) have rules about how rounding should be
>> performed on currency values in some circumstances; this is typically
>> NOT the same method as used by Rev.
>>
>> Rev will round as needed to the specified number of places after
>> decimal point (i.e. 2 in the code above). The rounding used is such
>> that midway values (i.e. exactly '5' in the following position) will
>> round upwards (e.g. 0.125 --> 0.13, 0.135 -> 0.14, etc.)
>> The UK rules on currency conversion required that for such "midway"
>> values you should always round to the even valued adjacent value
>> (e.g. 0.125 -> 0.12, 0.135 -> 0.14) - which had the advantage of
>> balancing out the rounding amounts over a large enough set of values.
>>
>> --
>> Alex Tweedly http://www.tweedly.net
>>
>>
>>
>> --
>> No virus found in this outgoing message.
>> Checked by AVG Anti-Virus.
>> Version: 7.0.344 / Virus Database: 267.10.18/90 - Release Date:
>> 05/09/2005
>>
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>
--
Alex Tweedly http://www.tweedly.net
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.10.18/90 - Release Date: 05/09/2005
More information about the use-livecode
mailing list