Browse Source

Parse frequency string as 64-bit float

The previous 32-bit parsing caused rounding errors due to low precision.

Closes #147
Martin Hebnes Pedersen 8 months ago
parent
commit
a0b9cf9f5d
1 changed files with 2 additions and 2 deletions
  1. 2 2
      freq.go

+ 2 - 2
freq.go

@@ -40,7 +40,7 @@ func (b Band) Contains(f Frequency) bool {
 	return f >= b.lower && f <= b.upper
 }
 
-type Frequency int
+type Frequency int // Hz
 
 func (f Frequency) String() string {
 	m := f / 1e6
@@ -121,7 +121,7 @@ func setFreq(rig hamlib.VFO, freq string) (newFreq, oldFreq int, err error) {
 		return 0, 0, fmt.Errorf("Unable to get rig frequency: %s", err)
 	}
 
-	f, err := strconv.ParseFloat(freq, 32)
+	f, err := strconv.ParseFloat(freq, 64)
 	if err != nil {
 		return 0, 0, err
 	}