-
Notifications
You must be signed in to change notification settings - Fork 298
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
Lsc info fix #3627
base: master
Are you sure you want to change the base?
Lsc info fix #3627
Conversation
I really don't know why they were there.
Works on our server (Zvezdolet, cherry-picked on top of .103 tag). LSC no longer lags. |
wouldn't this make hour long average a constant 0 if IO is below 72000EU/t? This would leads to unusable low precision at IV~early LuV IMO. |
No, it doesn't do that, here is an example of a base which had that level. |
It would look like it works, if energy comes and goes in in batches over the EU/t limit (e.g. laser hatches would do that), but I don't see it work for the actual scenario. The fix is easy though: don't do the division where the += and -= are at, but instead at the getter. |
Yeah, nvm, looking at the code for the second time, it probably underreports due to that. Even though it seems correct. |
There is a potential long overflow problem (which I think exists in 2.7 as well), where if you UXV 16M laser hatch, which is 9*10^15, and multiply that by 72000 (max times you can sum), which if awfully close to 2^63) |
There shouldn't be any long over/underflow issues unless the EU input is greater than LONG_MAX in a single tick, as the average is identical to what you'd get if you took an average normally - it can't overflow unless there's at least one data point which exceeds
This is almost certainly an issue though. I believe the fix would just be to use a double to represent it until double precision becomes a problem (which is |
This would work, but unlike using a double to accumulate it would have the overflow problem Georggi mentioned. |
Sorry I haven't made myself clear. Yeah, in current implementation, because you divide right away, it's not a problem. If the division were to be done when getting the value, but if it was done in the getter, as combusterf suggested, it would be close enough to maybe be a problem. Another case though (just for consideration). I think there can be a case with UMV (or a couple of UIV capacitors) it breaks a bit? outputLastTick and inputLastTick are already longs, so it's probably not for this PR (if at all needed), but the data there might be incorrect (lower than actual) and it's such an edge case that it probably should be ignored. |
There might be a new one tho
Replace the linked lists of boxed longs with a simple array.