Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrated 64bit long double into the toolchain #527

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

ZERICO2005
Copy link
Contributor

@ZERICO2005 ZERICO2005 commented Jan 10, 2025

Integrated a 64bit long double type into the toolchain, implemented using Berkeley SoftFloat 3e. SoftFloat is under toolchain/src/softfloat and CEdev/lib/softfloat currently. All CRT long double ABI calls have been implemented, along with some math.h functions.

The following routines are implemented with SoftFloat:

_dadd _dsub _dmul _ddiv _drem
_ftod _ltod _lltod _ultod _ulltod
_dtof _dtol _dtoll _dtoul _dtoull
fmal sqrtl fmodl modfl
truncl floorl ceill roundevenl nearbyintl
roundl lroundl llroundl
rintl lrintl llrint

I have also added the C23 int iszero(real-floating x) function to math.h. I also intend on adding issubnormal, nextup, and nextdown from C23.

@ZERICO2005 ZERICO2005 changed the title Implemented float64 long double using Berkeley SoftFloat 3e Integrated 64bit long double into the toolchain Jan 10, 2025
@ZERICO2005
Copy link
Contributor Author

ZERICO2005 commented Jan 25, 2025

long double float64 appears to work in both CEmu and on the calculator.
Summary of changes since January 11th:

  • All the float64 and float32 classification routines have been tested
  • float64 arithmetic and conversion works
  • optimized some routines in assembly
  • libcalls will directly call softfloat functions instead of going through a C wrapper function
  • wrote my own versions of _ftod _ltod _ultod _dtol _dtoll _dtoul _dtoull
  • ilogbl, frexpl, and ldexpl round correctly and properly handle denormal values
  • nextafter, nextup, nextdown, nexttowards are implemented for both float32 and float64
  • strtold was added (based off the current strtof routine)
  • added -Wimplicit-float-conversion -Wimplicit-int-float-conversion to catch bugs in libc functions
  • fixed difftime.c :)
  • added C++20 <numbers>
  • scalbn now aliases ldexp since FLT_RADIX is 2
  • Fixed fmaxf, fminf, and fdimf to handle NaNs/signed-zeros correctly
  • added C++ overloads for abs(floaing-point)

Mathematical functions (sinl, expl, tgammal, etc) and remainderl/remquol will be implemented later on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants