From 1d27d75c182bc548ad07edb6ce5f797a6e602c40 Mon Sep 17 00:00:00 2001 From: fdai7848 Date: Fri, 9 Feb 2024 21:41:49 +0100 Subject: [PATCH] add atan function --- src/reihen.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/reihen.c b/src/reihen.c index b58b27e..d194950 100644 --- a/src/reihen.c +++ b/src/reihen.c @@ -80,4 +80,18 @@ double tanD(double degrees){ } return sinD(degrees)/cosD(degrees); +} + +double atanD(double degrees){ + if (degrees>=360.0){ + degrees = squashDegreesTo360(degrees); + } + + double sum = 0.0; + double radian = radians(degrees); + for (int i = 0; i <= 9; i++){ + sum += powerD((double) i, -1.0) * (powerD(2.0*i+1, radian) / 2.0*i+1); + } + + return sum; } \ No newline at end of file