Although many Math built-in functions have a similar structure
these code paths were implemented as separate C functions.
After this patch only one common dispatcher remains which shares
the common code paths of different built-in functions. This
reduces the binary size by 1 Kbyte.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
Since the project is now hosted at the JS Foundation we can move to unified copyright notices for the project.
Starting with this commit all future contributions to the project should only carry the following copyright notice (except for third-party code which requires copyright information to be preserved):
"Copyright JS Foundation and other contributors, http://js.foundation" (without the quotes)
This avoids cluttering the codebase with contributor-specific copyright notices which have a higher maintenance overhead and tend to get outdated quickly. Also dropping the year from the copyright notices helps to avoid yearly code changes just to update the copyright notices.
Note that each contributor still retains full copyright ownership of his/her contributions and the respective authorship is tracked very accurately via Git.
JerryScript-DCO-1.0-Signed-off-by: Tilmann Scheller t.scheller@samsung.com
Legacy implementation made incorrect assumptions on how many bits
of useful information is returned by libc's `rand()`. If `RAND_MAX`
had more than 16 useful bits, it assumed that `rand()` could return
32 useful random bits. However, e.g., jerry-libc's `RAND_MAX` is
`0x7fffffff`, which denotes 31 useful bits only. The consequence
was that `Math.random()` covered only the lower half of the
standard-mandated `[0,1)` interval.
This path fixes the error and always uses the exact value of
`RAND_MAX` to compute the random value, which will thus fully cover
`[0,1)`.
Fixes#1414
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
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.hu
The standard doesn't defines ECMAScript Compact Profile as a subset of Ecma-262 Edition 5.1.
Profile modes can be added easily like the minimal profile if required.
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
* Rename modified fdlibm to jerry-libm
* Move third-party/fdlibm to jerry-libm
* Rename original fdlibm.h to jerry-libm-internal.h
* And remove it from the public headers.
* Rename jerry-libm's public header to math.h
* This also makes jerry-core sources include `<math.h>`. Therefore,
should anyone want to use a different libm implementation with
jerry, it becomes possible. (The same way as we provide a minimal
libc with standard headers, but should it be insufficient or
conflicting for someone, it can be replaced.)
* Drop `s_` prefix from jerry-libm sources
* The original fdlibm implementation had various prefixes (e.g., `k_`
for sources of kernel routines, and `w_` for wrapper routines), but
after the specialization of fdlibm to jerry, only `s_` remained.
Since it does not encode anything anymore, it can be dropped.
* Stylistic edits to jerry-libm's CMakeLists
* Align project name with other CMakeLists in the code base
* Move Jerry-LibM under Apache License
* Using the same approach as was used by linux-wireless when ath5k
driver license needed clarification. Solution was proposed by SFLC.
External mail for future reference: http://lwn.net/Articles/247806/
* Tests & checks
* Remove FD from the name of libm unit test-related files
* Make vera++ and cppcheck check jerry-libm
* Targets
* Speculative update of targets to use jerry-libm
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
Modifications:
* eliminate unnecessary variables, functions
* use ECMA_NUMBER macros where it is possible
* simplify code
* minor style fix (comments, increase-decrease operators)
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
Remove ecma_completion_value_t, and add an extra bit to
ecma_value_t to represent errors. From the long list of
completion types only normal and error remained.
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com