Page 2 of 2
Re: Is it possible to read the amount of fluid in a fluid wagon and output the result to a signal?
Posted: Mon Sep 12, 2022 8:32 pm
by ColonelSandersLite
mmmPI wrote: ↑Mon Sep 12, 2022 6:59 pm
Edit: Though , looking at it a bit more, ColonelSanders used the word " selfcontradiction" and not "confusion", i think then it would refers to something like 14.7 being rounded to down to 14, which is then not the "nearest" integer ?
That's the one!
Look, it's alright. I get that I'm just a weirdo. Doesn't mean I won't bitch and moan though.
mrvn wrote: ↑Mon Sep 12, 2022 7:53 pm
"rounded down" is "floor" or simply truncated
Those aren't the same thing.
-27 / 10 = ??
Round it down it's -3.
Truncate and it's -2.
In factorio circuit networks, it's -2. Yeah, I checked in the game to be sure since this stuff is now a matter of some controversy.
Re: Is it possible to read the amount of fluid in a fluid wagon and output the result to a signal?
Posted: Mon Sep 12, 2022 8:40 pm
by mmmPI
some things have changed, and keep changing it's impossible to track every changes !
mmmPI wrote: ↑Mon Sep 12, 2022 6:02 pm
if you always round down (to an integer) the name is truncated.
ColonelSandersLite wrote: ↑Mon Sep 12, 2022 8:32 pm
Those aren't the same thing.
-27 / 10 = ??
Round it down it's -3.
Truncate and it's -2.
I agree with the number and my sentence was imprecise, i had not thought of negative number, the second definition about discarding the decimal part is the correct one but i worded it imprecisely in my first sentence.
I've checked in game 14.7 does show 14 i don't want controversy
Re: Is it possible to read the amount of fluid in a fluid wagon and output the result to a signal?
Posted: Mon Sep 12, 2022 8:45 pm
by mrvn
ColonelSandersLite wrote: ↑Mon Sep 12, 2022 8:32 pm
mrvn wrote: ↑Mon Sep 12, 2022 7:53 pm
"rounded down" is "floor" or simply truncated
Those aren't the same thing.
-27 / 10 = ??
Round it down it's -3.
Truncate and it's -2.
In factorio circuit networks, it's -2. Yeah, I checked in the game to be sure since this stuff is now a matter of some controversy.
rounded down == floor(-27 / 10) == -3, "the largest integral value that is not greater than x".
Truncated indeed just throws away everything after the decimal dot and gets -2 and that is what factorio does. It just truncates:
Code: Select all
int amount = tank.fluid_box.amount; // truncate double to int
You would describe that more precisely as "round to 0" and not "rounded down". Natural languages are so flexible. Sorry for being imprecise.
But now it seems to check for 0 < x < 1 and round up that special case.
Re: Is it possible to read the amount of fluid in a fluid wagon and output the result to a signal?
Posted: Mon Sep 12, 2022 9:07 pm
by FuryoftheStars
ColonelSandersLite wrote: ↑Mon Sep 12, 2022 8:32 pm
mmmPI wrote: ↑Mon Sep 12, 2022 6:59 pm
Edit: Though , looking at it a bit more, ColonelSanders used the word " selfcontradiction" and not "confusion", i think then it would refers to something like 14.7 being rounded to down to 14, which is then not the "nearest" integer ?
That's the one!
Well, this is how I look at it: you're rounding down, so any values greater than your value are not considered. As such, you're looking for the "nearest" integer in the down direction.
Re: Is it possible to read the amount of fluid in a fluid wagon and output the result to a signal?
Posted: Mon Sep 12, 2022 9:24 pm
by mmmPI
FuryoftheStars wrote: ↑Mon Sep 12, 2022 9:07 pm
Well, this is how I look at it: you're rounding down, so any values greater than your value are not considered. As such, you're looking for the "nearest" integer in the down direction.
I think describing the process as its done on the wiki or as you do is the better way to explain on the wiki, it's what is there already
, because giving a name suppose everyone has the same definition, which would need to be explained, which would be the description of the process ...
Now the example of -27/10 would means according to "looking for the nearest integer in the down direction", -3, but in game it would show -2 according to ColonelSanders test.
However, in relation with the train stop itself, it cannot ouput negative content or ID number, so i guess what is on the wiki is correct because it is on the train stop page, the way the circuit network deals with -27/10 is not required to be explained there.
The wiki explain also how it behave differently between 0 and 1 which is helpful in game.
"the closest integer in the direction of 1 ?
" i don't think that even have a name
Re: Is it possible to read the amount of fluid in a fluid wagon and output the result to a signal?
Posted: Mon Sep 12, 2022 10:08 pm
by FuryoftheStars
Well, for the purposes of the fluid wagon, we are talking positive numbers. A fluid wagon cannot have a value less than 0. You can put that through a combinator to flip the sign, sure, but all the rounding work of the fluid wagon contents has already been done by this point.