SHOW:
|
|
- or go back to the newest paste.
1 | const calculate = n => { | |
2 | if ((n < -8 || n >= 1) && n != 3 && n != 2 && n <= 4) { | |
3 | return 1 / (n * Math.exp(n * n)); | |
4 | } else if ((n < 1 && n >= -4) || n == 3) { | |
5 | return Math.atan(n * n + 5) + Math.tan(n + 4.5) * Math.tan(n + 4.5); | |
6 | } else if ((n > 4 && n != 7) || n == -5) { | |
7 | return Math.sqrt(Math.abs(n) / 3 + n * n); | |
8 | } else if ((n < -4 && n >= -8 && n != -5) || n == 7) { | |
9 | return Math.log(n ** 4) / Math.log(9); | |
10 | } else { | |
11 | return 0; | |
12 | } | |
13 | }; | |
14 | ||
15 | for (let i = -15; i <= 15; ++i) { | |
16 | console.log({ | |
17 | i, | |
18 | value: calculate(i) | |
19 | }); | |
20 | } |