-
-
Notifications
You must be signed in to change notification settings - Fork 370
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add Radians to Degrees conversion (#49)
- Loading branch information
1 parent
95020af
commit cc247ea
Showing
2 changed files
with
18 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}); |