Questions tagged [fixed-point]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
26 views

Rounding fixed point integers

If I'm using fixed-point arithmetic to represent rates, for example, 2% in ray (27 decimal precision) would be 102000000000000000000000000000. If I had a rate like 101333333333333333333333333333 (1.33%...
0
votes
0answers
22 views

Can't store the value of a math operation. It's always 0

contract MyContract { uint public priceUSD = 1.70 * 10**8; // USD uint public priceEth; ......... function setPrice(uint newPriceUSD) external ownerOnly() returns(uint, uint) { uint ...
1
vote
1answer
51 views

Why don't decimals work in solidity?

I've read this question and answer thread about representing decimal values in solidity, and I understand that math is entirely done using fixed-point. However, I'm curious as to why this is the case. ...
14
votes
4answers
9k views

Can't do any integer division

I'm building a new smart contract but really can't figure out how to perform integer division. I know that fixed point numbers haven't been implemented yet but it should be possible to perform 100/3 = ...