```
stateful entrypoint getAMBCurrentCount() : int =
8 / 10 * 1000
```

I’m going to get 0. How do I represent that?

```
stateful entrypoint getAMBCurrentCount() : int =
8 / 10 * 1000
```

I’m going to get 0. How do I represent that?

you could implement a decimals type and create math functions for it. Alternatively maybe use bigger numbers, e.g. with 18 decimal 0 as usual in blockchain.

Is there an example where I want to get 80% of a number how do I write it?

1 Like

So as @philipp.chain explains you got two alternatives:

- you use a small enough denominator and settle for integer division - i.e. 80% of X is just
`(X * 80) / 100`

and you don’t need to worry about the result being the result of integer division. - you use rational numbers - it isn’t exactly rocket science to implement them but in fact Sophia even has a standard library for this Frac

2 Likes

Ok, I see,think you

1 Like