[Gambas-user] I create a new function to share

Doriano Blengino doriano.blengino at ...1909...
Fri Jun 26 18:50:41 CEST 2009


Benoît Minisini ha scritto:
>> Changed file "/usr/share/i18n/locales/it_IT" so the section:
>>
>>     LC_NUMERIC
>>     decimal_point             "<U002C>"
>>     thousands_sep             ""      <------------ empty string
>>     grouping                  0;0
>>     END LC_NUMERIC
>>
>>
>> results in:
>>
>>     LC_NUMERIC
>>     decimal_point             "<U002C>"
>>     thousands_sep             "<U002E>"   <------- dot simbol
>>     grouping                  0;0
>>     END LC_NUMERIC
>>
>>
>> ...and now it works ok.
>>
>> I don't know why there is this error - don't even know if this *is* an
>> error, but now it works as expected. If somebody confirms to me that the
>> value of *thousand_sep* should not be empty, I can post a bug to the
>> maintainer of the file *BUT*:
>>
>> It is worth to note that in that file, a few lines above, in the section
>> LC_MONETARY, the thousand separator is correctly indicated. As Benoit
>> says, all this could be correct - if we want thousand separators perhaps
>> we have to use the monetary notation and not a "general number" one. In
>> fact, to separate the thousands is more a commercial habit than a
>> general/scientific one. But if this is true, then perhaps gambas lacks a
>> CURRENCY data type, or a mean to use a currency/monetary representation
>> inside format$(). By the way, a CURRENCY data type could come handy by
>> itself - I had some problems with rounding floating point values and, in
>> all the places where calculations were done (simple additions and
>> subtraction of numbers with only two decimals of precision, normal for
>> currency), I had to modify the code and round down values myself - tired
>> of "1.999,99999998" numbers...
>>
>> In other languages the CURRENCY datatype is defined as an INT64 which,
>> when printed or mixed with other numerical types, is first divided (or
>> multiplied) by 10000 (ten thousands). In other words, the number 22,5
>> (twentytwo and a half) is stored as the integer 225000. This way, all
>> rounding errors are get rid of.
>>
>> Regards,
>> Doriano
>>
>>     
>
> I won't make a Currency data type, but you can do:
>
> Print Format$(Amount, "$0,###.##")
>
> to format currencies (see the documentation of Format).
>
> Regards,
>
>   
I saw the documentation, but not always I want to have the currency 
symbol printed... is there a way to use the thousand separator without 
putting a currency symbol in?

Thanks anyway and regards,
Doriano






More information about the User mailing list