# Trig question

**URL:** <https://forum.makecode.com/t/trig-question/28666>\
**Category:** Help\
**Created:** [May 9, 2024, 2:51am UTC](https://forum.makecode.com/t/trig-question/28666 "2024-05-09T02:51:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![RobbyZero](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/robbyzero/32/17188_2.png) [@RobbyZero](https://forum.makecode.com/u/RobbyZero)\
**Post date:** [May 9, 2024, 2:51am UTC](https://forum.makecode.com/t/trig-question/28666/1 "2024-05-09T02:51:03Z")

</div>

Hello forum,  
I had a question. I’m working on a project that involves very heavy math. Especially with trigonometry. The equation I’m using requires arctan but in the options I only see arctan2. Is there a workaround. Is it even going to matter. Please help me.

---

<div class="post-metadata">

**Author:** ![AlexK](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/alexk/32/33339_2.png) [@AlexK](https://forum.makecode.com/u/AlexK)\
**Post date:** [May 9, 2024, 3:24am UTC](https://forum.makecode.com/t/trig-question/28666/2 "2024-05-09T03:24:23Z")

</div>

As long as your angle is between – π/2 and + π/2, then you can get an equivalent value with `Math.atan2()`. Instead of using `Math.atan(x)`, use `Math.atan2(x, 1)`.

```typescript
let x: number = 1 // tan(pi / 4) = 1

// All of these should be the same, then: ~ 0.785398
game.splash(Math.PI / 4)
game.splash(Math.atan(x))
game.splash(Math.atan2(x, 1))

```

---

<div class="post-metadata">

**Author:** ![RobbyZero](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/robbyzero/32/17188_2.png) [@RobbyZero](https://forum.makecode.com/u/RobbyZero)\
**Post date:** [May 9, 2024, 2:01pm UTC](https://forum.makecode.com/t/trig-question/28666/3 "2024-05-09T14:01:59Z")

</div>

Thank you.

---

<div class="post-metadata">

**Author:** ![RobbyZero](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/robbyzero/32/17188_2.png) [@RobbyZero](https://forum.makecode.com/u/RobbyZero)\
**Post date:** [May 12, 2024, 1:02am UTC](https://forum.makecode.com/t/trig-question/28666/4 "2024-05-12T01:02:49Z")

</div>

Is it possible to set the mode from radians to degrees?  
Is it already in degrees?

---

<div class="post-metadata">

**Author:** ![AlexK](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/alexk/32/33339_2.png) [@AlexK](https://forum.makecode.com/u/AlexK)\
**Post date:** [May 12, 2024, 1:15am UTC](https://forum.makecode.com/t/trig-question/28666/5 "2024-05-12T01:15:03Z")

</div>

No, there is no way to switch “modes” for the trig functions. They always work in radians. The easiest way to deal with this is to use a pair of functions that convert between degrees and radians.

 ![Functions to convert between degrees and radians. 180 degrees = π radians.](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/b/bbef54450c3f5b42800a72e36cbfa187a80dfd33.png)
