Skip to content

Commit 03330aa

Browse files
committed
Fix arc tangent.
1 parent f2d24ea commit 03330aa

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/trig/trig.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,10 @@ namespace steppable::__internals::arithmetic
285285
std::string atan(const std::string& _x, const int decimals, const int mode)
286286
{
287287
auto x = _x;
288+
// Zero check
289+
if (isZeroString(x))
290+
return "0";
291+
288292
bool isReduced = false;
289293
if (compare(abs(x, 0), "1", 0) != "0")
290294
{

tests/testTrig.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,8 @@ _.assertIsEqual(asin("0.5", 2, 1), "30.00");
5656
_.assertIsEqual(asin("0", 2, 1), "0");
5757
SECTION_END()
5858

59+
SECTION(Test arc tangent)
60+
_.assertIsEqual(atan("0", 2, 1), "0");
61+
SECTION_END()
62+
5963
TEST_END()

0 commit comments

Comments
 (0)