-
Notifications
You must be signed in to change notification settings - Fork 211
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
Crashes - Floating Point Exception - Raspberry Pi #4847
Comments
Correction, the game does use floating point math. What I meant in our previous discussion was that a majority of the math operations use fixed-point integers. These are still number values in Typescript, but the fixed.ts library uses typing to constrain the values. If I understand it right, the hardware devices use run time type tagging to use integer math operations as long as the values are 30-bit integer numbers. But In any case, a floating point error during compilation is quite definitely a bug in the MakeCode implementation, that shouldn't happen no matter what type of math the source code is doing. |
Thanks for clarifying and sorry for misunderstanding and -representing your forum post regarding floating point operations, @klausw! Anyone has a tip about how to start debugging this and locating the bug in the lower levels and files when everything works on the top level - editor, simulator and several hardware except RPi? Pretty obvious in retrospective what the error was that @nopid found for the settings namaspace, but an impressive feat nonetheless to actually find it and locate the file(needle in the haystack) in which it resided, in my opinion. But in this case, even the MakeCode game code is quite large, and it could stem from anywhere in this working code. Then one has to find where and what makes it appear only on RPis... And how does "everyone" seem to know stuff like that the integer numbers are 30-bit etc.? Apart from the obvious - being better and more experienced coders than I - do you have access to some other special tools to help, like well-commented code, system/code/uml diagrams, serious documentation, custom debuggers, blueprints, whatever? ;-) The system is just to big and with too many moving parts for me to understand how everything works and fits together as a whole. -At least when there is no obvious link for the failure between working game code and non-working executables(with no c++ source code for this executable). At least two good news have come from trawling aimlessly through the source code in pursuit of this bug: A bonus is that it is satisfying to know that I still have A LOT to learn for years to come and might never ever find myself in a situation where there's a lack of challenge with both MakeCode and programming in general, that's for sure! Br, |
Tried to debug a little by compiling and downloading the game with the Gdb gave the following error on all threads: Then, i compiled Apart from the C++ SIGFPE conditions mentioned above, some people have indicated on forums that they have encountered the floating point exceptions when type casting or assigning an INT to an array of DOUBLE, or something similar. I don't know, I am a little at loss about how to locate this error effectively(or at all)... ;-) Any help is appreciated! |
Describe the bug
When compiling for and running @klausw's advanced 3D game, Space Rocks 3D! on a Raspberry Pi, it crashes with the error message "Floating Point Exception".
The game works well in the simulator, and has been tested without any errors on both the PyGamer and the Meowbit, indicating that this probably is an error specific to MakeCode's implementation on the Raspberry Pi and not the game code itself, akin to @nopid's recently fixed error in the Raspberry Pi(RPi) implementation of the namespace setting.
Further supporting that the error is in the compilation itself for the RPi, is the game author's testimony that the game code does not include any floating point operations at all.
I have found that on Posix systems, C++ normally emits Floating Point Exceptions unrelated to floating point operations, and that the exception is thrown rather on conditions of FE_DIVBYZERO, FE_INEXACT, FE_INVALID, FE_OVERFLOW, FE_UNDERFLOW and FE_ALL_EXCEPT.
Further, I have tried debug the game gode by guarding against any obvious divide-by-zero or overflow conditions(
tan(90)
etc.), to no avail and I have now reached the limits of my competence and depleted all ideas I had for pinpointing the error further. I do not master fully the nuances of integer sizes etc. on the RPi, or where to search for this bug in the pxt compiler code, but all (my) clues seem to lead in this direction.I really hope the MakeCode team or some bright individuals in the community(like @nopid) can figure out and rectify the difference between the RPi implementation and the implementations for the Web simulator, the PyGamer and the Meowbit, so that this and other future equally advanced 3D games will run also on the RPi!
To Reproduce
Steps to reproduce the behavior:
NB!: Very important to download from the beta version of MakeCode Arcade, since the production version is still haunted by the Segmentation Fault error from the RPi implementation of the Settings namespace.
Expected behavior
Game running equally well on the RPi as in the web simulator and on the PyGamer and the Meowbit.
(In the same spirit of e.g. @jwunderl's "...should probably not crash on hardware (unless it's somehow a valid error, in which case simulator should crash to match hardware :))" in this issue with some similarities.)
Screenshots
n/a
Desktop (please complete the following information):
See above
Smartphone (please complete the following information):
n/a
Additional context
n/a
The text was updated successfully, but these errors were encountered: