0

Is it possible do something like this in Solidity ?

100 - (100 * 0.01) = 98.9

And also this

10 / (10 * 10)
  • Does this answer your question? [Does Solidity supports floating point number](https://stackoverflow.com/questions/58277234/does-solidity-supports-floating-point-number) – MrFabio_25 Aug 24 '22 at 13:07

1 Answers1

0

In solidity there is no float numbers by default. Actually there are some 3rd party libraries like FixedMath or Fixidity etc.

But i highly recommend that do not use 3rd party libraries, change your approach.

If the question is solidity supports that? Then the answer is no.

But if the question is how to do that. You can multiply all values with 1 ether (10^18) and then do that math. Division to float should be done on front-end can be a great approach for this.