Format a Currency value

[quote=196492:@Norman Palardy]It should state a valid range as well like most of the other numeric data types do
Documentation error[/quote]

My point exactly. The “15 digits on the left and four on the right” description is inadequate. Whereas other types boundaries are very precisely described for instance for Integer : http://documentation.xojo.com/index.php/Integer

It is difficult for users to rely on a data type that is described in such an approximative way.

Thank you for stating [quote]This means the max is somewhere about 922337203685477.5807 [/quote] which is at least a precise limit.

not bug but not realizing it would overflow like any other number - which it does as its just a fixed point int64 under the hood

I’d still love a BCD type

Until BCD, Uint64 looks like the best way to avoid ridiculous results.

Unless of course one wants to count in Zimbabwean currency where several trillions hardly buy a pound of potatoes…

Uints might make no sense for certain values even when dealing with currency

Things like negative debits & credits in accounting definitely exist

[quote=196516:@Norman Palardy]Uints might make no sense for certain values even when dealing with currency

Things like negative debits & credits in accounting definitely exist[/quote]
You been spying on my checkbook again? (not that I have reached 900 trillion in debt… yet)

Wow! I really need to proof read my posts better. LOL indeed!

39907 - Binary Coded Decimal, please
Status: Needs Review Rank: Not Ranked Product: Xojo Category: Compiler

Michel Bujardet Today at 11:02 AM
Look at Format a Currency value - General - Xojo Programming Forum where it appears the Currency type does not conform to the description in the LR (documentation bug request filed separately)

For accounting applications, that limit maybe a big problem for currencies with much lesser value than the Dollar, like Japanese Yen for instance. Binary Coded Decimal seems to be the solution, it would be desirable to add this to Xojo. Especially as 64 bit may render the implementation easier.

<https://xojo.com/issue/39907>

[b]39908 - LR descripion of the Currency type inaccurate[/b]

Status: Needs Review Rank: Not Ranked Product: Xojo Category: Documentation » Language Reference

Michel Bujardet Today at 11:09 AM
OS: OS X 10.10.3

Xojo: Xojo 2015r2.2

Steps: Look at Is Currency data type really usable? - General - Xojo Programming Forum back in September 2014, and again recently Format a Currency value - General - Xojo Programming Forum where it appears the Currency type does not conform to the description in the LR.

"This is a 64-bit fixed-point number format that holds 15 digits to the left of the decimal point and 4 digits to the right. " is in fact, in the words of Norman Palardy :
“This means the max is somewhere about 922337203685477.5807”

In practice, this is not really 15 digits to the left, as the digits in question hit the limit imposed by the 64 bit representation.

It would be much better to say 14 digits to the left, so 99999999999999.9999 could be safely represented. This would avoid users getting frustrated.

<https://xojo.com/issue/39908>

To be perfectly complete, I forgot to mention Bob Delaney Decimal plugin, which is able to represent the Zimbabwean currency mass, given enough memory on the computer :
http://delaneyrm.com/

[quote=196681:@Michel Bujardet]To be perfectly complete, I forgot to mention Bob Delaney Decimal plugin, which is able to represent the Zimbabwean currency mass, given enough memory on the computer :
http://delaneyrm.com/[/quote]

Don’t be so rude about Mad Bob(Mugabe)'s place - he is highly revered locally. :wink:

Besides - the Zim main currencies are the USD and the ZAR, and the AK47.

this remebers me a trip to Serbia, where I bought a Yugoslav 500,000,000,000 dinar note :slight_smile:

No wonder Serbian’s preferred refuge currency is the Euro :wink: