You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
this is not a high-priority item at all, but maybe it would be nice to add a true 'decimal' floating-point number type to ficus, based on https://github.com/vpisarev/DEC64/tree/alt.
The rationale:
since it's purely software implementation that does not use floating-point operations internally, the operations on deci are guaranteed to give absolutely the same 'bit-exact' results on every platform, which can be useful for some accuracy-critical algorithms, reference implementations in tests etc.
for quite a broad range of values scanning/printing operations are 'bit-exact', i.e. the textual decimal representation of floating-point numbers perfectly matches the internal representation, unlike with IEEE754 binary-2 numbers.
the number of bits in deci's mantissa is greater than in double-precision IEEE754 format, hence the better accuracy can be achieved out-of-the-box. Besides, some extra primitives, such a super-accurate dot-product or Horner scheme (polynomial evaluation) can be added to the runtime to obtain even better accuracy (for IEEE754 formats such functions are possible and useful to implement as well though)
The details:
the type may be called 'deci', short for 'decimal'.
there should be 'd'/'D' suffix to specify literals of 'deci' type.
basic and not so basic operations on deci() (+, -, *, /, fmod, pow, sqrt, sin, cos, exp, log, etc.) will be added to ficus runtime and the standard library. Note: the current implementation partly uses __int128 type, which is GCC/clang extension. Need to add a branch for MSVC (the necessary multiply/divide intrinsics exist in MSVC).
operations on the type are converted to runtime calls at the C code generation phase.
some compile-time optimizations (e.g. constant folding, a+0, a*1 etc.) maybe applied to 'deci' operations
The text was updated successfully, but these errors were encountered:
this is not a high-priority item at all, but maybe it would be nice to add a true 'decimal' floating-point number type to ficus, based on https://github.com/vpisarev/DEC64/tree/alt.
The rationale:
The details:
The text was updated successfully, but these errors were encountered: