I've played enough sandbox to identify a couple times when 100 does not equal 100. Where 100 turns to 99.9 and you cannot obtain the last 1% I'm almost convinced it's due to rounding issues. I'm going to take fluid in pipes as my first example. The offshore pump doesn't push 999.9/s. Oil refineries don't produce 44.9 Petroleum Gas. Lubricant doesn't produce 19.9. But, as soon as any fluid enters a pipe, 0.1 fluid is lost and can't be made up. Perfect building to building connection (boiler -> steam engine -> steam engine) won't lose any of the fluid. Pipes shouldn't have a floating point for it's volume. Tanks shouldn't either. Make it a whole integer. The only thing that outputs floating points that I can recall are pumpjacks for crude oil. So, change it to a fixed INT (FLOOR() it's value: 16.8 = 16, 16.1 = 16, 0.9 = 0).
Second issue - also think it's related to floating points but not sure. Reproducable. Any science pack (let's start with just red Automation) while being consumed in a lab when power browns out (yellow or red energy bar), but not a blackout (zero energy). will consume 1% of the science pack so the research tech you've made 10 packs for 10 required will take 11 packs to complete with 99% left over of #11.
Yea, I'm nitpicking details. I want my 1%!
TY for reading. Hope to see this addressed.
Floating point math problems
-
- Filter Inserter
- Posts: 503
- Joined: Tue Jun 26, 2018 10:14 am
- Contact:
Re: Floating point math problems
Maybe fluids should not behave like solids? There may be an unusable puddle left in the pipe.
And what about gases? Can you squeeze a pipe till the vacuum?
And what about gases? Can you squeeze a pipe till the vacuum?
Re: Floating point math problems
Systems that have a possibility of not being full at all times in all places; behave in this way. You may be falling prey to the Observer effect. Fluid actively moving in and out of a pipe will never make it full. To fill a pipe section (or tank or whatever fluid thingy) completely, attach a pump into it leaving the other end disconnected.inick wrote: Wed Mar 04, 2020 7:10 pmWhere 100 turns to 99.9 and you cannot obtain the last 1% ... Yea, I'm nitpicking details. I want my 1%!
And as long as we're nitpicking, 1% of 100 is 1.
Re: Floating point math problems
Aye. Floating point math has been troublesome for me, and add percentages in floating point math and I need more than the few moments I took to write it to be possibly right. Still has a chance to be wrong.
You are correct. I am wrong of 1% of 100 is not 0.1
High school was so long ago. It's been... 84 year..no. It's approaching 30 though.