1

This question already has an answer here:

Decimals and Percentages in Solidity I'm making function about percentage

function setAddress(uint256 newValue) constant returns(uint256){ // tokenAddress = newAddress; // de a = 0.5; // decimals b = 0.5; value = newValue - 0.06; // value = newValue; return value; }

marked as duplicate by Richard Horrocks, Vignesh Karthikeyan, mafrasi2, Achala Dissanayake, Ismael Jun 2 '18 at 21:05

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • but I can't find solution – blockangular Jun 1 '18 at 19:48
  • 1
    There is already number of questions and information about handling decimals and percentages in solidity as it is a common topic. You need to work in uint values so think of how to produce your values with in uint types. For example, ether values are converted to Wei to remove decimals. If the available examples are not helping then I suggest you edit your question to give more information about what you are trying to achieve. – machine-uprising Jun 1 '18 at 20:04
1

You should use values in units of wei. Wei is the basic unit of ether.

1 ether = 1000000000000000000 wei

You may also use other fixed units like finney and szabo:

1 ether = 1000 finney

1 ether = 1000000 szabo

Not the answer you're looking for? Browse other questions tagged or ask your own question.