<p>There should not be any rounding because all operations are integer operations. The 8 digits is because they calculate using the base unit of Bitcoin, the satoshi, which is 0.00000001 Bitcoin (8 digits). It is calculated as an integer (i.e. calculation uses satoshis, not Bitcoin) multiplied by an integer for the number of bytes, thus the result will also be an integer. The decimal then comes back as they shift the decimal point to represent the value in Bitcoin. There is no rounding involved, if there is, you are doing something wrong.</p>

CC BY-SA 4.0
2018-05-10T10:22:48.693Z
Are you totally sure that  Markets like Binance or Gdax.etc do the same calculation like this?
Panagiotis Drakatos
CC BY-SA 4.0
2018-05-10T15:21:31.883Z
There is no reason not to do the calculation like this. If they do not do integer operations, then they introduce the possibility for floating point precision errors which can cause them to lost money for their customers.
Ava Chow
CC BY-SA 4.0
2019-02-22T17:29:33.830Z
Exchanges *do* have rounding errors.
Evert
CC BY-SA 4.0
2018-05-09T16:11:42.673Z
2018-05-09T16:11:42.673Z
Ava Chow
<p>I have a problem. I am struggling to calculate programmatically the number of cryptocurrencies because I sometimes have inaccuracies in the last digit. Does anybody know what the problem is? (Of course, I have calculated the appropriate fees that need). For example, Binance uses accuracy for 8 Digits. What is the Rounding that they used? I would appreciate an answer if someone have the appropriate knowledge on this matter</p>

<pre><code>RoundingMode.CEILING
RoundingMode.DOWN
RoundingMode.FLOOR
RoundingMode.HALF_DOWN
RoundingMode.HALF_EVEN
RoundingMode.HALF_UP
RoundingMode.UNNECESSARY
RoundingMode.UP
</code></pre>

CC BY-SA 4.0
2019-08-31T20:56:19.400Z
I am currently debugging exactly the same behaviour  as you describe in this issue. My balance for ETH does not add up if compared to my own calculations. At the moment, I assume that Binance does not credit the full amount of the deposit (e.g. 14 decimal places) to the account balance, but strips it to the precision they internally use (e.g. 8 decimal places). If I thereby apply `RoundingMode.DOWN ` as rounding mode, my results become valid.

I am still looking to get any confirmation on that though.
croeck
<transactions><transaction-fees><buy-bitcoins><binance>
What is the Default Rounding for 8 digits in Binance,tradingview,etc
Panagiotis Drakatos
# What is the Default Rounding for 8 digits in Binance,tradingview,etc

(Asked by: username_0 on 2018-05-09)

I have a problem. I am struggling to calculate programmatically the number of cryptocurrencies because I sometimes have inaccuracies in the last digit. Does anybody know what the problem is? (Of course, I have calculated the appropriate fees that need). For example, Binance uses accuracy for 8 Digits. What is the Rounding that they used? I would appreciate an answer if someone have the appropriate knowledge on this matter

```
RoundingMode.CEILING
RoundingMode.DOWN
RoundingMode.FLOOR
RoundingMode.HALF_DOWN
RoundingMode.HALF_EVEN
RoundingMode.HALF_UP
RoundingMode.UNNECESSARY
RoundingMode.UP

```

**Tags:** transactions, transaction-fees, buy-bitcoins, binance

> **Comments:**
> **username_1**: I am currently debugging exactly the same behaviour  as you describe in this issue. My balance for ETH does not add up if compared to my own calculations. At the moment, I assume that Binance does not credit the full amount of the deposit (e.g. 14 decimal places) to the account balance, but strips it to the precision they internally use (e.g. 8 decimal places). If I thereby apply `RoundingMode.DOWN ` as rounding mode, my results become valid.  I am still looking to get any confirmation on that though.  

---

## 1 answers

### Answer by username_2 on 2018-05-09. Score: 0 | Accepted answer

There should not be any rounding because all operations are integer operations. The 8 digits is because they calculate using the base unit of Bitcoin, the satoshi, which is 0.00000001 Bitcoin (8 digits). It is calculated as an integer (i.e. calculation uses satoshis, not Bitcoin) multiplied by an integer for the number of bytes, thus the result will also be an integer. The decimal then comes back as they shift the decimal point to represent the value in Bitcoin. There is no rounding involved, if there is, you are doing something wrong.

> **Comments:**
> **username_0**: Are you totally sure that  Markets like Binance or Gdax.etc do the same calculation like this?  
> **username_2**: There is no reason not to do the calculation like this. If they do not do integer operations, then they introduce the possibility for floating point precision errors which can cause them to lost money for their customers.  
> **username_3**: Exchanges *do* have rounding errors.  

---

