Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/expression/builtin_math.go
Original file line number Diff line number Diff line change
Expand Up @@ -1821,7 +1821,7 @@ func (b *builtinRadiansSig) evalReal(ctx EvalContext, row chunk.Row) (float64, b
if isNull || err != nil {
return 0, isNull, err
}
return x * math.Pi / 180, false, nil
return x * (math.Pi / 180), false, nil
}

type sinFunctionClass struct {
Expand Down
2 changes: 2 additions & 0 deletions pkg/expression/builtin_math_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,8 @@ func TestRadians(t *testing.T) {
{float64(180), float64(math.Pi)},
{-360, -2 * float64(math.Pi)},
{"180", float64(math.Pi)},
{float64(1.0e308), float64(1.7453292519943295e306)},
{float64(23), float64(0.4014257279586958)},
}

Dtbl := tblToDtbl(tbl)
Expand Down
2 changes: 1 addition & 1 deletion pkg/expression/builtin_math_vec.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ func (b *builtinRadiansSig) vecEvalReal(ctx EvalContext, input *chunk.Chunk, res
if result.IsNull(i) {
continue
}
f64s[i] = f64s[i] * math.Pi / 180
f64s[i] = f64s[i] * (math.Pi / 180)
}
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion tests/integrationtest/r/expression/builtin.result
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ crc32(0) crc32(-0) crc32('0') crc32('abc') crc32('ABC') crc32(NULL) crc32('') cr
4108050209 4108050209 4108050209 891568578 2743272264 NULL 0 62177901
SELECT radians(1.0), radians(pi()), radians(pi()/2), radians(180), radians(1.009);
radians(1.0) radians(pi()) radians(pi()/2) radians(180) radians(1.009)
0.017453292519943295 0.05483113556160754 0.02741556778080377 3.141592653589793 0.01761037215262278
0.017453292519943295 0.05483113556160755 0.027415567780803774 3.141592653589793 0.01761037215262278
drop table if exists t;
create table t(a int);
insert into t values(1),(2),(3);
Expand Down