fix: sql cast function when converting to float (#11817)

This commit is contained in:
mailsmail
2021-03-19 23:14:38 +07:00
committed by GitHub
parent b5dcaaccb4
commit 27eb4ae3bc
6 changed files with 43 additions and 20 deletions

View File

@@ -306,15 +306,6 @@ func (v Value) CSVString() string {
}
}
// floatToValue converts a float into int representation if needed.
func floatToValue(f float64) *Value {
intPart, fracPart := math.Modf(f)
if fracPart == 0 && intPart < math.MaxInt64 && intPart > math.MinInt64 {
return FromInt(int64(intPart))
}
return FromFloat(f)
}
// negate negates a numeric value
func (v *Value) negate() {
switch x := v.value.(type) {