# Math.asin in function-node

**URL:** <https://discourse.nodered.org/t/math-asin-in-function-node/87891>\
**Category:** General\
**Tags:** function-node\
**Created:** [12 May 2024 10:59 UTC](https://discourse.nodered.org/t/math-asin-in-function-node/87891 "2024-05-12T10:59:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ak68](https://avatars.discourse-cdn.com/v4/letter/a/977dab/32.png) [@ak68](https://discourse.nodered.org/u/ak68)\
**Post date:** [12 May 2024 10:59 UTC](https://discourse.nodered.org/t/math-asin-in-function-node/87891/1 "2024-05-12T10:59:37Z")

</div>

Hallo together,  
I want to build a function node to calculate from MPU6050-Gyro to angle

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/a/3a0e8ab279ba4e7860189bc1ad9799579aaf3cc6.png)

with function:

```auto
var korr = -(((Math.asin(msg.payload)/9.81)*180/Math.Pi)-2.8);
msg.payload = korr;
return msg;

```

... but I do´n´t get a correct result ...

Where´s my mistakt ?  
Thank you all 🙂 )

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [12 May 2024 11:09 UTC](https://discourse.nodered.org/t/math-asin-in-function-node/87891/2 "2024-05-12T11:09:29Z")

</div>

Edit - I didn't spot the value under the debug node.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [12 May 2024 11:22 UTC](https://discourse.nodered.org/t/math-asin-in-function-node/87891/3 "2024-05-12T11:22:58Z")

</div>

> [@ak68](#):
>
> `Math.asin(msg.payload)`

That is saying `Give me the angle whose sin is -5.61`. Since the sin of an angle is always between -1 and +1 that is impossible.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [10 August 2024 11:23 UTC](https://discourse.nodered.org/t/math-asin-in-function-node/87891/4 "2024-08-10T11:23:02Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
