package main import ( "math" ) func ToUint16(f float64) uint16 { if f > 65535 { return uint16(math.Mod(f, 65535)) } else { return uint16(f) } }