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

Linker Bug (Probably related to missing long double support) #444

Closed
TheMiningTeamYT opened this issue Sep 13, 2023 · 5 comments
Closed
Assignees

Comments

@TheMiningTeamYT
Copy link

I've written some code and while trying to compile it, it got through the compiler stage but when linking I got the error
Error: symbol ':globals.__dsub' is undefined or out of scope.
and my brain melted because I have no idea what that means.
However, guessing by the "d" I'm guessing it's related to double/long double support, and I do use long doubles all over my code because I want maximum math precision for what I'm doing. And I do know reading through other issues that double/long double support has been a problem for some time now.
If this is that, then you can probably just close this issue. Otherwise, I'd like to get this fixed.
error.txt

@mateoconlechuga
Copy link
Member

Can you either post the code here or send it privately so we can diagnose the issue please?

@mateoconlechuga
Copy link
Member

But yes, long double will most likely result in double functions attempting to be linked in. Also, if you read this: https://ce-programming.github.io/toolchain/static/hardware.html#floating-point-numbers

You may note that float and double have the same precision. If you want better precision, it is recommended to instead use an arbitrary-precision floating point library.

@runer112
Copy link
Member

If you want high precision, I'd suggest using TI's floating point type. There's a clunky C wrapper for it in ti/real.h and a sleek C++ wrapper for it in ti/real.

@TheMiningTeamYT
Copy link
Author

That was fast.
This should be everything you need. Let me know if you need anything else.
Please forgive my bad code. I'm not used to dealing with c strings and I'm not very good at planning out or adding comments to my code.
(btw, if you know of any good arbitrary precision math libraries for this, let me know, in the meantime I'll look into what runer112 mentioned)
convert.zip

@mateoconlechuga
Copy link
Member

Yeah it's confirmed that the compiler is emitting a call to __dsub (which is intended to be implemented or something). I'm going to mark it as a duplicate of #276 for now, but feel free to reopen if you have any other issues! It would be nice to get native support for these, but it's a little wild since it would be extremely inefficient.

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

No branches or pull requests

3 participants