mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 05:33:36 +00:00
lottie/expressions: force the precision down to single-precision floating point
This also removes some minor compiler warings with "Wdouble-promotion" issue: https://github.com/thorvg/thorvg/issues/3136
This commit is contained in:
parent
29b612237d
commit
d44f037bc0
5 changed files with 9 additions and 9 deletions
|
@ -233,10 +233,10 @@ jerry_value_is_undefined (const jerry_value_t value) /**< api value */
|
|||
*
|
||||
* @return stored number as double
|
||||
*/
|
||||
double
|
||||
float
|
||||
jerry_value_as_number (const jerry_value_t value) /**< api value */
|
||||
{
|
||||
return (double) ecma_get_number_from_value (value);
|
||||
return (float) ecma_get_number_from_value (value);
|
||||
} /* jerry_value_as_number */
|
||||
|
||||
/**
|
||||
|
@ -343,7 +343,7 @@ jerry_function_external (jerry_external_handler_t handler) /**< native handler
|
|||
* @return jerry_value_t created from the given double argument.
|
||||
*/
|
||||
jerry_value_t
|
||||
jerry_number (double value) /**< double value from which a jerry_value_t will be created */
|
||||
jerry_number (float value) /**< double value from which a jerry_value_t will be created */
|
||||
{
|
||||
return ecma_make_number_value ((ecma_number_t) value);
|
||||
} /* jerry_number */
|
||||
|
|
|
@ -170,7 +170,7 @@ ecma_errol0_dtoa (double val, /**< ecma number */
|
|||
high_bound.value = mid.value;
|
||||
high_bound.offset = mid.offset;
|
||||
|
||||
if (ECMA_NEXT_FLOAT (val) != INFINITY)
|
||||
if ((float) ECMA_NEXT_FLOAT (val) != (float) INFINITY)
|
||||
{
|
||||
high_bound.offset += (ECMA_NEXT_FLOAT (val) - val) * power_of_10 / (2.0 + ERROL0_EPSILON);
|
||||
}
|
||||
|
|
|
@ -203,7 +203,7 @@ ecma_builtin_number_prototype_object_to_string (ecma_number_t this_arg_number, /
|
|||
if (fraction_part > 0.0)
|
||||
{
|
||||
uint8_t digit;
|
||||
ecma_number_t precision = (ecma_number_get_next (this_arg_number) - this_arg_number) * 0.5f;
|
||||
ecma_number_t precision = (ecma_number_get_next (this_arg_number) - this_arg_number) * 0.5;
|
||||
precision = JERRY_MAX (precision, ECMA_NUMBER_MIN_VALUE);
|
||||
|
||||
do
|
||||
|
|
|
@ -957,7 +957,7 @@ ecma_op_to_length (ecma_value_t value, /**< ecma value */
|
|||
}
|
||||
|
||||
/* 4 */
|
||||
if (num <= 0.0f)
|
||||
if (num <= 0)
|
||||
{
|
||||
*length = 0;
|
||||
return ECMA_VALUE_EMPTY;
|
||||
|
@ -1005,7 +1005,7 @@ ecma_op_to_index (ecma_value_t value, /**< ecma value */
|
|||
}
|
||||
|
||||
/* 2.b - 2.d */
|
||||
if (integer_index < 0.0f || integer_index > ECMA_NUMBER_MAX_SAFE_INTEGER)
|
||||
if (integer_index < 0 || integer_index > ECMA_NUMBER_MAX_SAFE_INTEGER)
|
||||
{
|
||||
return ecma_raise_range_error (ECMA_ERR_INVALID_OR_OUT_OF_RANGE_INDEX);
|
||||
}
|
||||
|
|
|
@ -32,13 +32,13 @@ bool jerry_value_is_object (const jerry_value_t value);
|
|||
bool jerry_value_is_exception (const jerry_value_t value);
|
||||
jerry_value_t jerry_value_to_object (const jerry_value_t value);
|
||||
jerry_value_t jerry_value_to_string (const jerry_value_t value);
|
||||
double jerry_value_as_number (const jerry_value_t value);
|
||||
float jerry_value_as_number (const jerry_value_t value);
|
||||
int32_t jerry_value_as_int32 (const jerry_value_t value);
|
||||
uint32_t jerry_value_as_uint32 (const jerry_value_t value);
|
||||
jerry_value_t JERRY_ATTR_CONST jerry_undefined (void);
|
||||
jerry_value_t JERRY_ATTR_CONST jerry_null (void);
|
||||
jerry_value_t JERRY_ATTR_CONST jerry_boolean (bool value);
|
||||
jerry_value_t jerry_number (double value);
|
||||
jerry_value_t jerry_number (float value);
|
||||
jerry_value_t jerry_string (const jerry_char_t *buffer_p, jerry_size_t buffer_size, jerry_encoding_t encoding);
|
||||
jerry_value_t jerry_string_sz (const char *str_p);
|
||||
jerry_length_t jerry_string_length (const jerry_value_t value);
|
||||
|
|
Loading…
Add table
Reference in a new issue