Bitcoin Forum
May 11, 2024, 07:00:06 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: 1 2 3 [All]
  Print  
Author Topic: mtgox, please fix your rounding bugs  (Read 6070 times)
davout (OP)
Legendary
*
Offline Offline

Activity: 1372
Merit: 1007


1davout


View Profile WWW
November 19, 2010, 02:41:35 PM
 #1

See screenshot, this kind of stuff happens a lot.

Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715410806
Hero Member
*
Offline Offline

Posts: 1715410806

View Profile Personal Message (Offline)

Ignore
1715410806
Reply with quote  #2

1715410806
Report to moderator
ShadowOfHarbringer
Legendary
*
Offline Offline

Activity: 1470
Merit: 1005


Bringing Legendary Har® to you since 1952


View Profile
November 19, 2010, 02:52:59 PM
 #2

I don't know if mtgox knows or uses this, but PHP has special set of functions for this kind of things - it's called BC_MATH.

http://www.php.net/manual/en/book.bc.php

With it, it is possible to count any number with any needed precision.

davout (OP)
Legendary
*
Offline Offline

Activity: 1372
Merit: 1007


1davout


View Profile WWW
November 19, 2010, 02:59:56 PM
 #3

Also *never* use float column sql data types, when storing money values decimal is the way to go.
Edit : <troll>Also never use PHP</troll>

ribuck
Donator
Hero Member
*
Offline Offline

Activity: 826
Merit: 1039


View Profile
November 19, 2010, 03:06:13 PM
 #4

<troll>Also never use PHP</troll>

Indeed that's a troll. PHP offers all the tools you need to program sound decimal arithmetic.

PHP is inelegant, but it's capable and ubiquitous. A good software engineer can implement great systems with PHP if they need to.
ShadowOfHarbringer
Legendary
*
Offline Offline

Activity: 1470
Merit: 1005


Bringing Legendary Har® to you since 1952


View Profile
November 19, 2010, 03:12:35 PM
 #5

Also *never* use float column sql data types, when storing money values decimal is the way to go.

Precisely, i believe that in PHP it may be best to store floats as pure strings, and convert them when necessary. There were some nasty bugs in float-to-float comparisons in PHP, i don't remember if they fixed them all.

davout (OP)
Legendary
*
Offline Offline

Activity: 1372
Merit: 1007


1davout


View Profile WWW
November 19, 2010, 03:59:06 PM
 #6

Also *never* use float column sql data types, when storing money values decimal is the way to go.

Precisely, i believe that in PHP it may be best to store floats as pure strings, and convert them when necessary. There were some nasty bugs in float-to-float comparisons in PHP, i don't remember if they fixed them all.

You have it wrong, floats are not supposed to be used to store exact values, decimal types are designed for that purpose



<troll>Also never use PHP</troll>
Indeed that's a troll. PHP offers all the tools you need to program sound decimal arithmetic.

PHP is inelegant, but it's capable and ubiquitous. A good software engineer can implement great systems with PHP if they need to.

Just as a good math student can compute a block's hash with a pencil and some paper if he needs to.
Anyway, that's absolutely not the point, I respect PHP for what it is, a performant language that's really easy to learn. Personnally I switched for Rails years ago.

Anyway, I think the rounding issues probably would have been the same if coded in RoR without careful design and knowledge of the exact values handling good practices.


mtgox
Full Member
***
Offline Offline

Activity: 185
Merit: 102


View Profile WWW
November 19, 2010, 06:07:12 PM
 #7

davout: It is just a display issue. You really have something like $11.487 in your account. So just withdraw one penny less. I'm not using floats to store the account balances.   I suppose I should just floor the amount displayed.

ribuck
Donator
Hero Member
*
Offline Offline

Activity: 826
Merit: 1039


View Profile
November 19, 2010, 06:14:08 PM
 #8

I suppose I should just floor the amount displayed.
No, you should display the actual balance. If the real balance has three digits after the decimal, you should show three digits.
kiba
Legendary
*
Offline Offline

Activity: 980
Merit: 1014


View Profile
November 19, 2010, 06:18:02 PM
 #9

Also, can you please automatically calculate the fee?

nanotube
Hero Member
*****
Offline Offline

Activity: 482
Merit: 501


View Profile WWW
November 19, 2010, 07:47:31 PM
 #10

+1 on showing actual balances without rounding.

+1 on pre-calculating the fee that would be charged, and showing it to the user to see before submitting an order.

Join #bitcoin-market on freenode for real-time market updates.
Join #bitcoin-otc - an over-the-counter trading market. http://bitcoin-otc.com
OTC web of trust: http://bitcoin-otc.com/trust.php
My trust rating: http://bitcoin-otc.com/viewratingdetail.php?nick=nanotube
bitcoinex
Sr. Member
****
Offline Offline

Activity: 350
Merit: 252


probiwon.com


View Profile WWW
November 19, 2010, 09:07:52 PM
 #11

+1 on showing actual balances without rounding.

are you ready to see the numbers like this:

12.3234453404553525454656

?

In a system that can trade fractional offerings such numbers are always presented. Simple rounding on sending and receiving sides negate it to the fixed-precise and beautiful numbers.

By the way, btcex.com do not use the decimal rounding. We rounding to the smallest possible size of the quantum of currency. Usually it is 0.01 but not always, it can be exotic such as 0.001 or 0.025.

New bitcoin lottery: probiwon.com
- Moжeт, ты eщё и в Heвидимyю Pyкy Pынкa вepyeшь? - Зaчeм жe вepoвaть в тo, чтo мoжнo нaблюдaть нeпocpeдcтвeннo?
tcatm
Sr. Member
****
Offline Offline

Activity: 337
Merit: 265


View Profile
November 19, 2010, 09:13:01 PM
 #12

you could limit all prices to 4..6 decimal places.
ribuck
Donator
Hero Member
*
Offline Offline

Activity: 826
Merit: 1039


View Profile
November 19, 2010, 09:13:43 PM
 #13

are you ready to see the numbers like this:

12.3234453404553525454656

No. MtGox already calculates the transactions to a certain level of precision (I think it might be 4). All we want is for our real MtGox balance to be exposed through the interface.

Without that, we can't withdraw our entire balance. If it says 80 bitcoins, but rejects our request to withdraw 80 bitcoins, how are we to know that we really need to ask for 79.9775?
tcatm
Sr. Member
****
Offline Offline

Activity: 337
Merit: 265


View Profile
November 19, 2010, 09:18:45 PM
 #14

Without that, we can't withdraw our entire balance. If it says 80 bitcoins, but rejects our request to withdraw 80 bitcoins, how are we to know that we really need to ask for 79.9775?

Click on "Account History".
bitcoinex
Sr. Member
****
Offline Offline

Activity: 350
Merit: 252


probiwon.com


View Profile WWW
November 19, 2010, 09:19:45 PM
 #15

are you ready to see the numbers like this:

12.3234453404553525454656

No. MtGox already calculates the transactions to a certain level of precision (I think it might be 4).

It's awful. On the set of small transactions rounding error can reach substantial quantities! Trading robots resent!

New bitcoin lottery: probiwon.com
- Moжeт, ты eщё и в Heвидимyю Pyкy Pынкa вepyeшь? - Зaчeм жe вepoвaть в тo, чтo мoжнo нaблюдaть нeпocpeдcтвeннo?
ribuck
Donator
Hero Member
*
Offline Offline

Activity: 826
Merit: 1039


View Profile
November 19, 2010, 10:46:05 PM
 #16

Click on "Account History".
Thanks! I see three decimal places for all the calculated values.
ShadowOfHarbringer
Legendary
*
Offline Offline

Activity: 1470
Merit: 1005


Bringing Legendary Har® to you since 1952


View Profile
November 20, 2010, 03:51:29 PM
 #17

Also *never* use float column sql data types, when storing money values decimal is the way to go.

Precisely, i believe that in PHP it may be best to store floats as pure strings, and convert them when necessary. There were some nasty bugs in float-to-float comparisons in PHP, i don't remember if they fixed them all.

You have it wrong, floats are not supposed to be used to store exact values, decimal types are designed for that purpose


No, you have it wrong, because You are talking about databases, not PHP. PHP does not have something like "decimal types" as far as i know.

But PHP has the strings, which can store almost anything with any precision you need.

ShadowOfHarbringer
Legendary
*
Offline Offline

Activity: 1470
Merit: 1005


Bringing Legendary Har® to you since 1952


View Profile
November 20, 2010, 03:54:07 PM
 #18

+1 on showing actual balances without rounding.

+1 on pre-calculating the fee that would be charged, and showing it to the user to see before submitting an order.

It's awful. On the set of small transactions rounding error can reach substantial quantities! Trading robots resent!

I agree with all of these suggestions.
Trading should be done with (almost ?) absolute rounding precision, if possible.

The Madhatter
Hero Member
*****
Offline Offline

Activity: 490
Merit: 509


My avatar pic says it all


View Profile
November 20, 2010, 04:25:42 PM
 #19

PHP's float precision can be adjusted in the php.ini file too.
wumpus
Hero Member
*****
Offline Offline

Activity: 812
Merit: 1022

No Maps for These Territories


View Profile
November 20, 2010, 04:39:11 PM
 #20

Financial programming lesson one: never use floats for money!

If there is no built-in fixed-point decimal type in your language it's best to use large integers.... or indeed, strings, although that makes computation somewhat harder.

Bitcoin Core developer [PGP] Warning: For most, coin loss is a larger risk than coin theft. A disk can die any time. Regularly back up your wallet through FileBackup Wallet to an external storage or the (encrypted!) cloud. Use a separate offline wallet for storing larger amounts.
bitcoinex
Sr. Member
****
Offline Offline

Activity: 350
Merit: 252


probiwon.com


View Profile WWW
November 20, 2010, 05:32:27 PM
 #21

Financial programming lesson one: never use floats for money!

If there is no built-in fixed-point decimal type in your language it's best to use large integers.... or indeed, strings, although that makes computation somewhat harder.


A bit more complicated in the exchange software because it uses non-integer multipliers.
It is important that the sum of inflows and outflows accurately matched. But the relation between them can be a tad bit inaccurate.

New bitcoin lottery: probiwon.com
- Moжeт, ты eщё и в Heвидимyю Pyкy Pынкa вepyeшь? - Зaчeм жe вepoвaть в тo, чтo мoжнo нaблюдaть нeпocpeдcтвeннo?
ShadowOfHarbringer
Legendary
*
Offline Offline

Activity: 1470
Merit: 1005


Bringing Legendary Har® to you since 1952


View Profile
November 20, 2010, 06:11:20 PM
 #22

or indeed, strings, although that makes computation somewhat harder.

...not in PHP.

wumpus
Hero Member
*****
Offline Offline

Activity: 812
Merit: 1022

No Maps for These Territories


View Profile
November 20, 2010, 08:20:52 PM
 #23

Financial programming lesson one: never use floats for money!

If there is no built-in fixed-point decimal type in your language it's best to use large integers.... or indeed, strings, although that makes computation somewhat harder.


A bit more complicated in the exchange software because it uses non-integer multipliers.
It is important that the sum of inflows and outflows accurately matched. But the relation between them can be a tad bit inaccurate.
Fixed-point arithmetic with non-integer multipliers ain't rocket science either. Before the times of GPUs and fast floating point units, we used to do that a lot in games.
But in this case it is probably best to use a reliable and well-tested library, instead of reinventing another wheel. Isn't there some open source project implementing a Decimal() type for PHP?

Bitcoin Core developer [PGP] Warning: For most, coin loss is a larger risk than coin theft. A disk can die any time. Regularly back up your wallet through FileBackup Wallet to an external storage or the (encrypted!) cloud. Use a separate offline wallet for storing larger amounts.
bitcoinex
Sr. Member
****
Offline Offline

Activity: 350
Merit: 252


probiwon.com


View Profile WWW
November 20, 2010, 08:59:29 PM
 #24

Financial programming lesson one: never use floats for money!

If there is no built-in fixed-point decimal type in your language it's best to use large integers.... or indeed, strings, although that makes computation somewhat harder.


A bit more complicated in the exchange software because it uses non-integer multipliers.
It is important that the sum of inflows and outflows accurately matched. But the relation between them can be a tad bit inaccurate.
Fixed-point arithmetic with non-integer multipliers ain't rocket science either. Before the times of GPUs and fast floating point units, we used to do that a lot in games.
But in this case it is probably best to use a reliable and well-tested library, instead of reinventing another wheel. Isn't there some open source project implementing a Decimal() type for PHP?

Each SQL database engine contains a types what you mean. For example, btcex.com provides 1000 digits of precision for you!

btcex.com btcex.com btcex.com btcex.com btcex.com

New bitcoin lottery: probiwon.com
- Moжeт, ты eщё и в Heвидимyю Pyкy Pынкa вepyeшь? - Зaчeм жe вepoвaть в тo, чтo мoжнo нaблюдaть нeпocpeдcтвeннo?
nanotube
Hero Member
*****
Offline Offline

Activity: 482
Merit: 501


View Profile WWW
November 20, 2010, 11:25:30 PM
 #25

+1 on showing actual balances without rounding.

are you ready to see the numbers like this:

12.3234453404553525454656

?

Why, yes, yes i am. Bring them on, please. As long as they accurately represent the balance in my account, it's all good.

Though note that it should never get to so many decimal places, since there's a limit to how many decimal places bid/ask offer inputs can take. But even if it does - I'd rather see the real amount than a rounded one.

Join #bitcoin-market on freenode for real-time market updates.
Join #bitcoin-otc - an over-the-counter trading market. http://bitcoin-otc.com
OTC web of trust: http://bitcoin-otc.com/trust.php
My trust rating: http://bitcoin-otc.com/viewratingdetail.php?nick=nanotube
bitcoinex
Sr. Member
****
Offline Offline

Activity: 350
Merit: 252


probiwon.com


View Profile WWW
November 21, 2010, 12:33:34 AM
 #26

+1 on showing actual balances without rounding.

are you ready to see the numbers like this:

12.3234453404553525454656

?

Why, yes, yes i am. Bring them on, please. As long as they accurately represent the balance in my account, it's all good.

Though note that it should never get to so many decimal places, since there's a limit to how many decimal places bid/ask offer inputs can take. But even if it does - I'd rather see the real amount than a rounded one.

Even the price and volume of this small accuracy generates such large precision numbers when you using "limit" orders type.

Do not want to seem intrusive, but we have no such restriction. More precisely, now you can write approx 15 characters of price.

New bitcoin lottery: probiwon.com
- Moжeт, ты eщё и в Heвидимyю Pyкy Pынкa вepyeшь? - Зaчeм жe вepoвaть в тo, чтo мoжнo нaблюдaть нeпocpeдcтвeннo?
nanotube
Hero Member
*****
Offline Offline

Activity: 482
Merit: 501


View Profile WWW
November 21, 2010, 06:13:56 AM
 #27

Even the price and volume of this small accuracy generates such large precision numbers when you using "limit" orders type.
Still, as i said, no problem for me. It doesn't cost my eyes anything to see extra digits.

Do not want to seem intrusive, but we have no such restriction. More precisely, now you can write approx 15 characters of price.

checked out your exchange site... a few comments for you, which i hope may be helpful. more competition in exchanges is always good. Smiley

1. it seems that there are no outstanding asks on the site? you need to get some market makers in there, at least until you have a bigger population of traders.

2. your fees seem to be rather large... 6% one way, 50rub the other way? if you want to compete with established exchanges like bcm and mtgox, you have to offer competitive fees. or possibly even start with zero fees, to attract clientele

3. don't know how possible it is... but if you allowed USD exchange on your site as well as RUB, you'd have more interested clientele.

3.1. To that end, you need to finish your translation to EN, there's a bunch of russian in places even if EN is selected. The 'rules' page is in fact completely in russian.

Well, that's it for now. hope that helps. Smiley

Join #bitcoin-market on freenode for real-time market updates.
Join #bitcoin-otc - an over-the-counter trading market. http://bitcoin-otc.com
OTC web of trust: http://bitcoin-otc.com/trust.php
My trust rating: http://bitcoin-otc.com/viewratingdetail.php?nick=nanotube
davout (OP)
Legendary
*
Offline Offline

Activity: 1372
Merit: 1007


1davout


View Profile WWW
November 21, 2010, 08:28:49 AM
 #28

Also *never* use float column sql data types, when storing money values decimal is the way to go.

Precisely, i believe that in PHP it may be best to store floats as pure strings, and convert them when necessary. There were some nasty bugs in float-to-float comparisons in PHP, i don't remember if they fixed them all.

You have it wrong, floats are not supposed to be used to store exact values, decimal types are designed for that purpose


No, you have it wrong, because You are talking about databases, not PHP. PHP does not have something like "decimal types" as far as i know.

But PHP has the strings, which can store almost anything with any precision you need.

Yes, of course I'm talking about databases, as stated earlier I don't do PHP (anymore).
Suggesting to use strings says a lot about your coding skills/experience.

Extra question for mtgox : correct me if i'm wrong but i don't think LR allows more than two decimal places when expressing LRUSD amounts, so, what's the point of storing more decimal places for LRUSD balance ? Rounding should be done at trade time, not display time, so no-one ends up with unusable dollar crumbs.

Also, an easy solution for the which precision should be used for displaying i see two easy answers :
 - "You don't have that much USD" error message changed into "You don't have that much USD, your balance is XX.XXXXX"
 - Display full precision when amount is hovered by the mouse, pretty easy with title attribute


wumpus
Hero Member
*****
Offline Offline

Activity: 812
Merit: 1022

No Maps for These Territories


View Profile
November 21, 2010, 10:42:43 AM
 #29

Each SQL database engine contains a types what you mean. For example, btcex.com provides 1000 digits of precision for you!

btcex.com btcex.com btcex.com btcex.com btcex.com
We are not talking about SQL engines here, I know every SQL since 92 has had a built-in decimal type with configurable precision. I also know that many other languages (Java, Python,...) have Decimal support in the standard library.

The problem is that PHP has no built-in support for computing with these, so my question was if PHP has a (open source) library to do this. Because converting money amounts to floating point is a very dangerous idea. Mtgox is written in PHP so we have to do with PHP, the fact that you don't do PHP anymore is not important.

Bitcoin Core developer [PGP] Warning: For most, coin loss is a larger risk than coin theft. A disk can die any time. Regularly back up your wallet through FileBackup Wallet to an external storage or the (encrypted!) cloud. Use a separate offline wallet for storing larger amounts.
bitcoinex
Sr. Member
****
Offline Offline

Activity: 350
Merit: 252


probiwon.com


View Profile WWW
November 21, 2010, 11:40:58 AM
 #30

Each SQL database engine contains a types what you mean. For example, btcex.com provides 1000 digits of precision for you!

btcex.com btcex.com btcex.com btcex.com btcex.com
We are not talking about SQL engines here,

Very vain

Quote
I know every SQL since 92 has had a built-in decimal type with configurable precision. I also know that many other languages (Java, Python,...) have Decimal support in the standard library.

The problem is that PHP has no built-in support for computing with these, so my question was if PHP has a (open source) library to do this. Because converting money amounts to floating point is a very dangerous idea. Mtgox is written in PHP so we have to do with PHP, the fact that you don't do PHP anymore is not important.

btcex.com also written on the PHP and it does not prevent him from working as it should in the matter of rounding and precision.

Trying to do the main computations in PHP-frontend is a bad design.

New bitcoin lottery: probiwon.com
- Moжeт, ты eщё и в Heвидимyю Pyкy Pынкa вepyeшь? - Зaчeм жe вepoвaть в тo, чтo мoжнo нaблюдaть нeпocpeдcтвeннo?
wumpus
Hero Member
*****
Offline Offline

Activity: 812
Merit: 1022

No Maps for These Territories


View Profile
November 21, 2010, 11:53:56 AM
 #31

Well, doing all computations in the SQL engine isn't very good design either. Especially not those that are only used for showing numbers in the UI. It means a lot of unnecessary round-trips to your database server...
Of course, for updates to the accounts it's a different story.

Bitcoin Core developer [PGP] Warning: For most, coin loss is a larger risk than coin theft. A disk can die any time. Regularly back up your wallet through FileBackup Wallet to an external storage or the (encrypted!) cloud. Use a separate offline wallet for storing larger amounts.
bitcoinex
Sr. Member
****
Offline Offline

Activity: 350
Merit: 252


probiwon.com


View Profile WWW
November 21, 2010, 11:55:17 AM
Last edit: November 21, 2010, 12:35:37 PM by bitcoinex
 #32

Even the price and volume of this small accuracy generates such large precision numbers when you using "limit" orders type.
Still, as i said, no problem for me. It doesn't cost my eyes anything to see extra digits.

Imagine that all the numbers associated with money, will look this way?
12.3234453404553525454656

(While this number did not give an absolute accuracy!)

Quote
Do not want to seem intrusive, but we have no such restriction. More precisely, now you can write approx 15 characters of price.

checked out your exchange site... a few comments for you, which i hope may be helpful. more competition in exchanges is always good. Smiley

1. it seems that there are no outstanding asks on the site? you need to get some market makers in there, at least until you have a bigger population of traders.

This chicken and egg problem in some way. I'm not interested in the trading, I was more interested in the technical implementation. Maybe someone will be a marketmaker?

Quote
2. your fees seem to be rather large... 6% one way, 50rub the other way? if you want to compete with established exchanges like bcm and mtgox, you have to offer competitive fees. or possibly even start with zero fees, to attract clientele

This is only for RUB, and this is because of taxes.

WM* deposits is free and withdraw only 3%.
(Forgot to write, thank you for info.)

Quote
3. don't know how possible it is... but if you allowed USD exchange on your site as well as RUB, you'd have more interested clientele.

In this topic I am looking for people who agree to maintain accounts for other currencies:
https://www.bitcoin.org/smf/index.php?topic=1485.0

Now we are preparing for the EUR and JPY.

Quote
3.1. To that end, you need to finish your translation to EN, there's a bunch of russian in places even if EN is selected. The 'rules' page is in fact completely in russian.

Ok

Quote
Well, that's it for now. hope that helps. Smiley

Thanks for comments!

New bitcoin lottery: probiwon.com
- Moжeт, ты eщё и в Heвидимyю Pyкy Pынкa вepyeшь? - Зaчeм жe вepoвaть в тo, чтo мoжнo нaблюдaть нeпocpeдcтвeннo?
bitcoinex
Sr. Member
****
Offline Offline

Activity: 350
Merit: 252


probiwon.com


View Profile WWW
November 21, 2010, 11:58:17 AM
 #33

Well, doing all computations in the SQL engine isn't very good design either. Especially not those that are only used for showing numbers in the UI. It means a lot of unnecessary round-trips to your database server...
Of course, for updates to the accounts it's a different story.


Huh

Each page of any complexity is shown by one call to the database

New bitcoin lottery: probiwon.com
- Moжeт, ты eщё и в Heвидимyю Pyкy Pынкa вepyeшь? - Зaчeм жe вepoвaть в тo, чтo мoжнo нaблюдaть нeпocpeдcтвeннo?
wumpus
Hero Member
*****
Offline Offline

Activity: 812
Merit: 1022

No Maps for These Territories


View Profile
November 21, 2010, 12:01:38 PM
 #34

Ehh yeah sure, if you store everything in one big table...

Bitcoin Core developer [PGP] Warning: For most, coin loss is a larger risk than coin theft. A disk can die any time. Regularly back up your wallet through FileBackup Wallet to an external storage or the (encrypted!) cloud. Use a separate offline wallet for storing larger amounts.
bitcoinex
Sr. Member
****
Offline Offline

Activity: 350
Merit: 252


probiwon.com


View Profile WWW
November 21, 2010, 12:04:49 PM
 #35

Ehh yeah sure, if you store everything in one big table...




 Wink

New bitcoin lottery: probiwon.com
- Moжeт, ты eщё и в Heвидимyю Pyкy Pынкa вepyeшь? - Зaчeм жe вepoвaть в тo, чтo мoжнo нaблюдaть нeпocpeдcтвeннo?
davout (OP)
Legendary
*
Offline Offline

Activity: 1372
Merit: 1007


1davout


View Profile WWW
November 21, 2010, 01:14:32 PM
 #36

Each page of any complexity is shown by one call to the database
Yea right Wink

ShadowOfHarbringer
Legendary
*
Offline Offline

Activity: 1470
Merit: 1005


Bringing Legendary Har® to you since 1952


View Profile
November 21, 2010, 02:28:39 PM
 #37

The problem is that PHP has no built-in support for computing with these

Actually, i think that BC_MATH extension is compiled-in PHP in most Linux distributions. If I am wrong, then You will probably have to compile a version with that yourself.
I don't remember ever selecting "bc_math" extension in ubuntu/debian when installing PHP anyway, sho it should be built-in. I cannot confirm this for sure, because I'm not running debian/ubuntu now. Can somebody else confirm this ?

   * bcadd — Add two arbitrary precision numbers
    * bccomp — Compare two arbitrary precision numbers
    * bcdiv — Divide two arbitrary precision numbers
    * bcmod — Get modulus of an arbitrary precision number
    * bcmul — Multiply two arbitrary precision number
    * bcpow — Raise an arbitrary precision number to another
    * bcpowmod — Raise an arbitrary precision number to another, reduced by a specified modulus
    * bcscale — Set default scale parameter for all bc math functions
    * bcsqrt — Get the square root of an arbitrary precision number
    * bcsub — Subtract one arbitrary precision number from another

ribuck
Donator
Hero Member
*
Offline Offline

Activity: 826
Merit: 1039


View Profile
November 21, 2010, 03:18:33 PM
 #38

Actually, i think that BC_MATH extension is compiled-in PHP in most Linux distributions.

BC_MATH is widely available, and if it isn't in your distro (or at your ISP) then it's likely that GMP is available. Either of these libraries is suitable for arbitrary precision decimal arithmetic without glitches.
ShadowOfHarbringer
Legendary
*
Offline Offline

Activity: 1470
Merit: 1005


Bringing Legendary Har® to you since 1952


View Profile
November 21, 2010, 08:06:11 PM
 #39

Actually, i think that BC_MATH extension is compiled-in PHP in most Linux distributions.

BC_MATH is widely available, and if it isn't in your distro (or at your ISP) then it's likely that GMP is available. Either of these libraries is suitable for arbitrary precision decimal arithmetic without glitches.

WOW, it's even better than i though.

PHP has actually **TWO** different libraries just for doing arbitrary precision arithmetics ! This is awesome. PHP FTW.

ribuck
Donator
Hero Member
*
Offline Offline

Activity: 826
Merit: 1039


View Profile
November 21, 2010, 08:32:02 PM
 #40

WOW ... PHP has actually **TWO** different libraries just for doing arbitrary precision arithmetics ! This is awesome. PHP FTW.

I'll let you into a secret.

I only mentioned two of them. But PHP actually has **ELEVEN**! Ruby only goes up to ten.
ribuck
Donator
Hero Member
*
Offline Offline

Activity: 826
Merit: 1039


View Profile
November 21, 2010, 08:33:17 PM
 #41

Ehh yeah sure, if you store everything in one big table...

Or if you know the mysteries of SQL "Join".
jib
Member
**
Offline Offline

Activity: 92
Merit: 10


View Profile
January 18, 2011, 08:28:09 AM
 #42

Account history screenshot attached:



Things that concern me:

  • Rounding is inconsistent. e.g most of the site's UI and the Description column of this table show 2 decimal places, and other columns of this table show 3.
  • When the rest of the site showed I had 47.79 BTC (which was actually 47.787) I was allowed to sell it all and get to -0.003 BTC. This is much more serious, as it shows that the inconsistent rounding and related problems affect the application's behaviour, not just the UI.
  • My current balance (-0.003 BTC) is shown as -0 by the API. This is bad; the API shouldn't be hiding information.
  • The transaction fees aren't shown anywhere in this table; they're hidden by tweaking the displayed price or something. Mt Gox should be more transparent about what the actual price was at each trade and what the transaction fee was for each trade.
  • We're never told what precision the numbers are calculated to internally. Mt. Gox should be more transparent about how many bitcoins I actually own. Is it -0, or -0.003, or -0.0032567 or something else?
Pages: 1 2 3 [All]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!