Skip to content
Open
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
3 changes: 3 additions & 0 deletions calc.go
Original file line number Diff line number Diff line change
Expand Up @@ -4202,6 +4202,9 @@ func (fn *formulaFuncs) ATAN2(argsList *list.List) formulaArg {
if y.Type == ArgError {
return y
}
if x.Number == 0 && y.Number == 0 {
return newErrorFormulaArg(formulaErrorDIV, formulaErrorDIV)
}
return newNumberFormulaArg(math.Atan2(x.Number, y.Number))
}

Expand Down
1 change: 1 addition & 0 deletions calc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2903,6 +2903,7 @@ func TestCalcCellValue(t *testing.T) {
"ATAN2()": {"#VALUE!", "ATAN2 requires 2 numeric arguments"},
"ATAN2(\"X\",0)": {"#VALUE!", "strconv.ParseFloat: parsing \"X\": invalid syntax"},
"ATAN2(0,\"X\")": {"#VALUE!", "strconv.ParseFloat: parsing \"X\": invalid syntax"},
"ATAN2(0,0)": {"#DIV/0!", "#DIV/0!"},
// BASE
"BASE()": {"#VALUE!", "BASE requires at least 2 arguments"},
"BASE(1,2,3,4)": {"#VALUE!", "BASE allows at most 3 arguments"},
Expand Down
Loading