> For the complete documentation index, see [llms.txt](https://calnix.gitbook.io/aave-book/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://calnix.gitbook.io/aave-book/primer/wadraylibrary/wip-scaling-different-decimal-representations.md).

# WIP: Scaling different decimal representations

###

* TokenA is set up with 18 decimals (WAD)
* TokenB is set up with 6 decimals

If you want to convert between different representations you have to multiply or divide depending on the difference in decimals count:

```markdown
**To convert valueA to valueB: (18 dp -> 6 dp)
    valueB = valueA / 10**(A.decimals - B.decimals)
    valueB = valueA / (10**(18-6))
```

#### Convert from WAD to 6 dp:

B is a WAD

<figure><img src="/files/OBPXnjQ4D0ZeGi7DUTik" alt=""><figcaption></figcaption></figure>

* Normalize B by dividing by its decimal places, 10\*\*18
* Then scale up by the desired decimals, 10\*\*6
* **However, when applying in solidity, we have to reverse the order of operations to ensure division is done last.**&#x20;
