Page 1 of 1
Signal with floating point value
Posted: Fri Jun 03, 2016 9:43 pm
by XKnight
At this moment every signal is an integer value and this is very reasonable for almost all items, because you can not imagine half iron plate.
Except liquids, which is basically stored in tank as a floating point value and can not be represented in integer value without rounding.
So, my suggestion is to use floating point value for liquids.
All combinator operations (+-/*) also should use floating point value, and rounding should be applied only if liquid value is converted into the regular value.
Re: Signal with floating point value
Posted: Fri Jun 03, 2016 11:52 pm
by bobucles
Floats aren't appropriate for anything. All useful values under the sun can be comfortably expressed with int.
But wait! How would you express the smaller values with int? Easy. Move the decimal point. So 1.00 becomes 100. Wow. Much difficult. And now you never have to deal with any dumb floating point issues ever again.
Re: Signal with floating point value
Posted: Sat Jun 04, 2016 1:03 am
by DaveMcW
Floats are appropriate for fluids. Representing 2,000.00 oil as 200,000 is much too confusing.
Re: Signal with floating point value
Posted: Sat Jun 04, 2016 11:19 am
by bobucles
There's nothing confusing about it, because it's completely invisible to the end user. It can even be invisible to modders as well. There's only so many decimal points required before realizing a tenth of a drop of oil doesn't mean anything.
Floats have been and always will be APPROXIMATE values. Estimations are sim engine suicide.
Re: Signal with floating point value
Posted: Sat Jun 04, 2016 11:53 am
by ArderBlackard
bobucles wrote:Floats aren't appropriate for anything. All useful values under the sun can be comfortably expressed with int.
Could you please help me with expressing 1/3 with int? And PI please.
Fixed-point arithmetics can be useful only to increase calculation performance, which is not the case here (or if you are writing a complex math processor with custom calculations). Aside from this you are just reinventing the wheel.
Re: Signal with floating point value
Posted: Sat Jun 04, 2016 12:03 pm
by thereaverofdarkness
Integer rounding error has been bothering me. When I plug a specific amount of research units into the lab, sometimes it works fine, other times it stops at 100% completion and I have to insert one more science pack, which will have 100% remaining after the research completes.
Re: Signal with floating point value
Posted: Sat Jun 04, 2016 7:16 pm
by DaveMcW
bobucles wrote:There's nothing confusing about it, because it's completely invisible to the end user. It can even be invisible to modders as well. There's only so many decimal points required before realizing a tenth of a drop of oil doesn't mean anything.
Ok, so you agree with the OP. There should be a fluid signal that looks like a float and acts like a float, and no one cares what format it uses internally.
Re: Signal with floating point value
Posted: Sun Jun 05, 2016 2:32 am
by thereaverofdarkness
bobucles wrote:There's only so many decimal points required before realizing a tenth of a drop of oil doesn't mean anything.
It means nothing when you have a tenth of a drop extra sitting in your tank, but it means a lot when you have 99.999 and you need 100.000. If the game is going to be dropping decimals, it should round remaining quantities up, not down.
Re: Signal with floating point value
Posted: Sun Jun 05, 2016 9:18 am
by steinio
thereaverofdarkness wrote:bobucles wrote:There's only so many decimal points required before realizing a tenth of a drop of oil doesn't mean anything.
It means nothing when you have a tenth of a drop extra sitting in your tank, but it means a lot when you have 99.999 and you need 100.000. If the game is going to be dropping decimals, it should round remaining quantities up, not down.
Tanks are fixed:
viewtopic.php?f=11&t=24558#p154947
Re: Signal with floating point value
Posted: Sun Jun 05, 2016 1:27 pm
by bobucles
It means nothing when you have a tenth of a drop extra sitting in your tank, but it means a lot when you have 99.999 and you need 100.000. If the game is going to be dropping decimals, it should round remaining quantities up, not down.
That's the beauty of ints. You can't gain or lose any material due to the silly rounding errors that are inescapable with a computer float. It's the same every time across all systems. Losing material by chopping pipe is of course the player's fault.
Re: Signal with floating point value
Posted: Sun Jun 05, 2016 2:18 pm
by Rseding91
The entire circuit system is designed around ints. It's not a simple "add a signal with a float value" as the signal is not the thing that stores the value - it just identifies.
As in:
Code: Select all
local signals = {["CopperOreSignal"] = 7}
"CopperOreSignal" has nothing to do with the type being stored and the type being stored is shared between all signals on the entire network - it can't be swapped for just one.
I see little/no value in spending tons of man hours and the time to pay them to add in the ability to do that with how little it will benefit the gameplay.
Re: Signal with floating point value
Posted: Mon Jun 06, 2016 6:48 am
by thereaverofdarkness
steinio wrote:thereaverofdarkness wrote:bobucles wrote:There's only so many decimal points required before realizing a tenth of a drop of oil doesn't mean anything.
It means nothing when you have a tenth of a drop extra sitting in your tank, but it means a lot when you have 99.999 and you need 100.000. If the game is going to be dropping decimals, it should round remaining quantities up, not down.
Tanks are fixed:
viewtopic.php?f=11&t=24558#p154947
It is fixed! I upgraded my version recently and I was just playing with petroleum gas today, and I got what seemed to be exact amounts, instead of slightly shrunk values!