Open lygstate opened 3 days ago
The original goal of JERRY_NUMBER_TYPE_FLOAT64 == 0 build configuration is supporting platforms which doesn't have hardware accelerated double precision floating point support. For example ESP32 has only single precision floating point support, using double numbers can be done only with softfp, which is significantly slower. Of course, this configuration has drawbacks, for example loosing ECMAScript compatibility, many features, etc.
compatibility
If that's only for platforms which doesn't have hardware accelerated double precision floating point support.
then we only need use float
do arithmetic and use double
for storage, that is when double + dobule
we can convert to float + float
and then save the result back to double
, that will significantly simplfy the code and more ECMAScript compatibility without performance penalty on ESP32
, as we won't use softfp do double + double
double-double
double*double
double/double
.
And convert double to float
or convert float to double
is fast without hardware fp
I have the will do sumbit a MR for that, I need to know if this is the right direction and acceptable
Sounds good to me, but I can speak only for myself.
CC: @zherczeg @akosthekiss @robertsipka
This is an outdated feature from ES 5.1. Since that JS become far more complex. If somebody needs float, probably an old, ES 5.1 version of the engine is enough. From newer versions, this feature could be deleted.
This is an outdated feature from ES 5.1. Since that JS become far more complex. If somebody needs float, probably an old, ES 5.1 version of the engine is enough. From newer versions, this feature could be deleted.
OK let's me delete it first
Currently, the
JERRY_NUMBER_TYPE_FLOAT64 == 0
have too much drawback because it's can not represent full int32_t, so indeed all bitwise operation is invalid whenJERRY_NUMBER_TYPE_FLOAT64 == 0
, if JERRY_NUMBER_TYPE_FLOAT64 is not for save memory, then we can use float do arithmatic but use double do storage.From my point of view,
ECMA_TYPE_FLOAT = 2, /**< pointer to a 64 or 32 bit floating point number */
can not save memory memory, because the minimal alignment of pointer is 8, so the size of allocated address minimal is 8, theJERRY_NUMBER_TYPE_FLOAT64 == 0
can not save memory, only increase performance.So my will is only use
JERRY_NUMBER_TYPE_FLOAT64 == 0
to do floating arithmetic, but usedouble
to do storage.