diff --git a/jerry-core/config.h b/jerry-core/config.h index 784ddd16c..4d0960747 100644 --- a/jerry-core/config.h +++ b/jerry-core/config.h @@ -86,6 +86,10 @@ && CONFIG_ECMA_NUMBER_TYPE != CONFIG_ECMA_NUMBER_FLOAT64 */ #endif /* !CONFIG_ECMA_NUMBER_TYPE */ +#if (!defined (CONFIG_DISABLE_DATE_BUILTIN) && (CONFIG_ECMA_NUMBER_TYPE == CONFIG_ECMA_NUMBER_FLOAT32)) +# error "Date does not support float32" +#endif + /** * Representation for ecma-characters */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-string-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-string-prototype.c index 2144de5dd..b35a17135 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-string-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-string-prototype.c @@ -817,7 +817,7 @@ ecma_builtin_string_prototype_object_replace_get_string (ecma_builtin_replace_se if (ecma_is_value_empty (ret_value)) { - arguments_list[match_length] = ecma_make_number_value (context_p->match_start); + arguments_list[match_length] = ecma_make_uint32_value (context_p->match_start); arguments_list[match_length + 1] = ecma_copy_value (context_p->input_string); ECMA_TRY_CATCH (result_value, @@ -1117,7 +1117,7 @@ ecma_builtin_string_prototype_object_replace_loop (ecma_builtin_replace_search_c ECMA_TRY_CATCH (put_value, ecma_op_object_put (regexp_obj_p, last_index_string_p, - ecma_make_number_value (context_p->match_end + 1), + ecma_make_uint32_value (context_p->match_end + 1), true), ret_value); @@ -1529,7 +1529,7 @@ ecma_builtin_helper_split_match (ecma_value_t input_string, /**< first argument ecma_property_value_t *index_prop_value_p = ecma_get_named_data_property (obj_p, magic_index_str_p); ecma_number_t index_num = ecma_get_number_from_value (index_prop_value_p->value); - ecma_value_assign_number (&index_prop_value_p->value, index_num + start_idx); + ecma_value_assign_number (&index_prop_value_p->value, index_num + (ecma_number_t) start_idx); ecma_deref_ecma_string (magic_index_str_p); } diff --git a/jerry-core/ecma/operations/ecma-regexp-object.c b/jerry-core/ecma/operations/ecma-regexp-object.c index faa514e41..56ce38b19 100644 --- a/jerry-core/ecma/operations/ecma-regexp-object.c +++ b/jerry-core/ecma/operations/ecma-regexp-object.c @@ -1375,8 +1375,8 @@ ecma_regexp_exec_helper (ecma_value_t regexp_value, /**< RegExp object */ if (sub_str_p != NULL && input_buffer_p != NULL) { - lastindex_num = lit_utf8_string_length (input_buffer_p, - (lit_utf8_size_t) (sub_str_p - input_buffer_p)); + lastindex_num = (ecma_number_t) lit_utf8_string_length (input_buffer_p, + (lit_utf8_size_t) (sub_str_p - input_buffer_p)); } else { diff --git a/tests/jerry/array-prototype-lastindexof.js b/tests/jerry/array-prototype-lastindexof.js index c158eeb73..4aa2c5f4f 100644 --- a/tests/jerry/array-prototype-lastindexof.js +++ b/tests/jerry/array-prototype-lastindexof.js @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +// This test will not pass on FLOAT32 due to precision issues + var obj = {}; var array = ["foo", 19, "bar", obj, "foo", 29, "baz"]; diff --git a/tests/jerry/array-prototype-push.js b/tests/jerry/array-prototype-push.js index 717843743..84a55e9bf 100644 --- a/tests/jerry/array-prototype-push.js +++ b/tests/jerry/array-prototype-push.js @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +// This test will not pass on FLOAT32 due to precision issues + var len; var d = []; assert (d.length === 0); diff --git a/tests/jerry/array-prototype-reduce-right.js b/tests/jerry/array-prototype-reduce-right.js index 1e5a1f81b..a9a71cb27 100644 --- a/tests/jerry/array-prototype-reduce-right.js +++ b/tests/jerry/array-prototype-reduce-right.js @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +// This test will not pass on FLOAT32 due to precision issues + var func = function(a, b) { return a + b; } diff --git a/tests/jerry/array-prototype-reduce.js b/tests/jerry/array-prototype-reduce.js index 5b787bb85..6193ec7f0 100644 --- a/tests/jerry/array-prototype-reduce.js +++ b/tests/jerry/array-prototype-reduce.js @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +// This test will not pass on FLOAT32 due to precision issues + var func = function(a, b) { return a + b; } diff --git a/tests/jerry/array-prototype-slice.js b/tests/jerry/array-prototype-slice.js index 7a9b9a67d..bb1a2e800 100644 --- a/tests/jerry/array-prototype-slice.js +++ b/tests/jerry/array-prototype-slice.js @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +// This test will not pass on FLOAT32 due to precision issues + var array = [54, undefined, "Lemon", -127]; var array1 = array.slice(); diff --git a/tests/jerry/array-prototype-splice.js b/tests/jerry/array-prototype-splice.js index d3249af86..c5c01ab50 100644 --- a/tests/jerry/array-prototype-splice.js +++ b/tests/jerry/array-prototype-splice.js @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +// This test will not pass on FLOAT32 due to precision issues + function setDefaultValues() { return [54, undefined, -127, "sunshine"]; diff --git a/tests/jerry/global-uri-coding.js b/tests/jerry/global-uri-coding.js index 28de4ba1d..169507bd4 100644 --- a/tests/jerry/global-uri-coding.js +++ b/tests/jerry/global-uri-coding.js @@ -14,6 +14,8 @@ // URI encoding +// This test will not pass on FLOAT32 due to precision issues + function checkEncodeURIParseError (str) { try { diff --git a/tests/jerry/json-parse.js b/tests/jerry/json-parse.js index 91f75a2ea..6b4986d6f 100644 --- a/tests/jerry/json-parse.js +++ b/tests/jerry/json-parse.js @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +// This test will not pass on FLOAT32 due to precision issues + // Checking primitve types var str; var result; diff --git a/tests/jerry/number-prototype-to-string.js b/tests/jerry/number-prototype-to-string.js index 8322480a0..f40be51fc 100644 --- a/tests/jerry/number-prototype-to-string.js +++ b/tests/jerry/number-prototype-to-string.js @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +// This test will not pass on FLOAT32 due to precision issues + assert((NaN).toString() === "NaN"); assert((-Infinity).toString() === "-Infinity"); assert((Infinity).toString() === "Infinity");