Commit 9d4f7c9
committed
Fixing Math.pow
The Math.pow implementation relies on libm's pow. However, the ISO C
and ES5.1 standards differ on pow:
* `x ** NAN` is NAN in ES but `+1 ** y` is 1 in C
* `+-1 ** +-INF` is NAN in ES but 1 in C
This patch:
* Modifies the Math.pow implementation to handle the special cases
instead calling pow.
* Adds a test case to jerry-test-suite as it did not test
`Math.pow(1,NaN)`.
* Fixes jerry-libm's pow, as it was not standard conforming, which
helped hiding the error in Math.pow.
* Updates the unit test for libm.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu1 parent 8f76bab commit 9d4f7c9
File tree
5 files changed
+41
-6
lines changed- jerry-core/ecma/builtin-objects
- jerry-libm
- tests
- jerry-test-suite/15/15.08/15.08.02/15.08.02.13
- unit
- tools/unit-tests
5 files changed
+41
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
477 | 477 | | |
478 | 478 | | |
479 | 479 | | |
480 | | - | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
481 | 490 | | |
482 | 491 | | |
483 | 492 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| |||
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
50 | | - | |
| 51 | + | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
| |||
133 | 134 | | |
134 | 135 | | |
135 | 136 | | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
136 | 143 | | |
137 | 144 | | |
138 | 145 | | |
| |||
184 | 191 | | |
185 | 192 | | |
186 | 193 | | |
187 | | - | |
| 194 | + | |
188 | 195 | | |
189 | | - | |
| 196 | + | |
190 | 197 | | |
191 | 198 | | |
192 | 199 | | |
| |||
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
330 | 330 | | |
331 | 331 | | |
332 | 332 | | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
333 | 338 | | |
334 | 339 | | |
335 | 340 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
465 | 465 | | |
466 | 466 | | |
467 | 467 | | |
468 | | - | |
469 | 468 | | |
470 | 469 | | |
471 | 470 | | |
472 | 471 | | |
473 | 472 | | |
474 | | - | |
475 | 473 | | |
476 | 474 | | |
477 | 475 | | |
| |||
0 commit comments