Skip to content

Commit

Permalink
feat: Add Radians to Degrees conversion (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
MohdFaisalBidda authored Oct 13, 2022
1 parent 95020af commit cc247ea
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Maths/RadiansToDegrees.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/** * A function to get degrees from the radians
* @param {number} radians - The input integer
* @return {number} degrees of radians
* @example radiansToDegrees(0.7853) => 45 | radiansTiDegrees(1.5708) => 90
* @see https://en.m.wikipedia.org/wiki/Radian
* @author MohdFaisalBidda <https://github.com/MohdFaisalBidda>
*/

export const radiansToDegrees =(radians:number):number =>{
return radians * 180/Math.PI;
}
7 changes: 7 additions & 0 deletions Maths/test/RadiansToDegrees.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import {radiansToDegrees} from '../RadiansToDegrees';

test("RadiansToDegrees", () => {
expect(radiansToDegrees(0)).toBe(0);
expect(radiansToDegrees(0.7853981633974483)).toBe(45);
expect(radiansToDegrees(1.5707963267948966)).toBe(90);
});

0 comments on commit cc247ea

Please sign in to comment.