I get data from an api request and perform a calculation based on the value.
Let say my bank account or crypto account have a balance of 301.38481999999999
I want to withdraw all of the money, but the float64 variable in golang automatically round up the variable to 301.38482 which caused the withdrawal operation to fail because I do not have that much money in my account.
package main
import(
    "log"
)
func main(){
    var myvar float64
    myvar = 301.38481999999999
    log.Println(myvar)
}
https://play.golang.org/p/BXk9fcVJZVn
It show
301.38482
How can I get the exact balance with exact number so that I can withdraw all of it?
 
     
    