Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

pyton

func JSONToAmount(jsonAmount float64) (int64) {
  var amount int64
  tempVal := 1e8 * jsonAmount
  if tempVal < 0 {
     tempVal = tempVal - 0.5
  }
  if tempVal > 0 {
    tempVal = tempVal + 0.5
  }
  // Then just rely on the integer truncating
  amount = int64(tempVal)
  return amount
}
Source by en.bitcoin.it #
 
PREVIOUS NEXT
Tagged: #pyton
ADD COMMENT
Topic
Name
4+3 =