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

Floating point arithmetic exception on ShipAICmd.cpp #4288

CampNowhere opened this Issue Jan 22, 2018 · 3 comments


None yet
4 participants

CampNowhere commented Jan 22, 2018

To replicate: Go to star system referenced in the attached file. Target the first planet orbiting the black hole (BH1b1), hit autopilot, and "enter low orbit around BH1b1".

I re-implemented the std::max function locally to make debugging easier, but the same exception happens with current master (4d32739). It looks like there's a max operation being done on the xmm1 and xmm2 registers being done before returning, for some reason. I'm not sure why this is happening. The greater than comparison is being done in the ucomisd instruction a couple of lines above. And nonsense data (0x800000....) seems to be loaded into xmm1.

I'll work on this further, I just wanted to put it out there for everyone else to look at.




This comment has been minimized.


jaj22 commented Jan 23, 2018

The black hole is coming out of the sysgen with zero radius. The terrain code has no idea what to do with a zero-radius body, so the terrain feature height comes out as a NaN which is passed through to the black hole's m_physradius. This throws an exception in the autopilot, because we enable exceptions around it.

I don't know what physical radius black holes are supposed to have. Maybe the event horizon?

@jaj22 jaj22 added the CONFIRMED label Jan 25, 2018


This comment has been minimized.


impaktor commented Feb 10, 2018

I don't know what physical radius black holes are supposed to have. Maybe the event horizon?

Sounds reasonable. So what would the best fix be for this issue? Why does the black hole have zero radius? It doesn't in the lua-file, as far as I can see.


This comment has been minimized.


richardpl commented Jun 20, 2018

Lua file doesn't set radius of black hole, so it defaults to 0 for some reason.

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