# Math exponential function

**URL:** https://discourse.nodered.org/t/math-exponential-function/16146
**Category:** General
**Created:** [1 October 2019 12:26 UTC](https://discourse.nodered.org/t/math-exponential-function/16146 "2019-10-01T12:26:33Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Venom](https://avatars.discourse-cdn.com/v4/letter/v/8c91f0/32.png) [@Venom](https://discourse.nodered.org/u/Venom)
#### Post date: [1 October 2019 12:26 UTC](https://discourse.nodered.org/t/math-exponential-function/16146/1 "2019-10-01T12:26:33Z")

</div>

Hello  
I have a function called y = 1034,7e^-0,028x. I have used this Math.log(number/1024)/-0.028 and it works most of the time but isn´t always precise. I heard that you can somehow input this y = 1034,7e^-0,028x and it will be more precise. Anyone has any clues on how to do this?

---

<div class="post-metadata">

### Author: ![kuema](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kuema/32/6542_2.png) [@kuema](https://discourse.nodered.org/u/kuema)
#### Post date: [1 October 2019 13:00 UTC](https://discourse.nodered.org/t/math-exponential-function/16146/2 "2019-10-01T13:00:36Z")

</div>

Javascript numbers are 64-bit floating points, so you have a limited precision.

> **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)**
>
> The Number JavaScript object is a wrapper object allowing you to work with numerical values. A Number object is created using the Number() constructor. A primitive type object number is created using the Number() function.

If you need arbitrary precision for your calculations, I believe there are NodeJS packages on NPM that could do that for you. These can be made available in your `settings.js` in the `functionGlobalContext` object for use in a function 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: [1 October 2019 13:39 UTC](https://discourse.nodered.org/t/math-exponential-function/16146/3 "2019-10-01T13:39:10Z")

</div>

Can you show an example with the value of x, the result and what it should be?  
Also show the code in the function node that calculates it.
