How does golang get the number of decimal places in float64?

all I want is the number of decimal places, that is, how many decimal places there are. Thank you

May.10,2022

A relatively simple method is to convert it to a string and then calculate the length after the decimal point

len (strings.Split (fmt.Sprintf ("% v", a), ".) [1])

Menu