important bug fix:infinite recursion occurs on constellation calculation

This commit is contained in:
2021-08-13 14:26:08 +08:00
parent a23770a0b6
commit a225f49209
3 changed files with 14 additions and 13 deletions
+2 -5
View File
@@ -1,9 +1,7 @@
package tools
import (
"fmt"
"math"
"strconv"
)
func Sin(x float64) float64 {
@@ -31,9 +29,8 @@ func ArcTan(x float64) float64 {
}
func FloatRound(f float64, n int) float64 {
format := "%." + strconv.Itoa(n) + "f"
res, _ := strconv.ParseFloat(fmt.Sprintf(format, f), 64)
return res
p := math.Pow10(n)
return math.Floor(f*p+0.5) / p
}
func Limit360(x float64) float64 {