[0.4.0] Train stop delay time decrements by one

This subforum contains all the issues which we already resolved.
MF-
Smart Inserter
Smart Inserter
Posts: 1235
Joined: Sun Feb 24, 2013 12:07 am
Contact:

[0.4.0] Train stop delay time decrements by one

Post by MF- »

I am pretty sure you are aware of this one..

Select a stop, set it to 10s
select another stop, select back the first stop
It now reads 9s
kovarex
Factorio Staff
Factorio Staff
Posts: 8298
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [0.4.0] Train stop delay time decrements by one

Post by kovarex »

We were both trying to reproduce this without success.
MF-
Smart Inserter
Smart Inserter
Posts: 1235
Joined: Sun Feb 24, 2013 12:07 am
Contact:

Re: [0.4.0] Train stop delay time decrements by one

Post by MF- »

Or, even simpler:

Place down some track, place a train stop, place a locomotive
open the locomotive
add the stop

It reads 29s (instead of expected 30s)
I was too lazy to build turrets around the train test area and time the actual stop delay.

(When I drag the slider one notch to the right, it starts saying "30", but it reverts back to "29" and the old slider position when I close and open the UI)

If that's not happening to you, I guess it could be some linux-specific oddity?
kovarex
Factorio Staff
Factorio Staff
Posts: 8298
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [0.4.0] Train stop delay time decrements by one

Post by kovarex »

Now I understood the cause of the problem.
We are compiling the linux ship version with the -ffast-math, but we don't have it in debug version, so it was hard to find out.
With this options, it seems like 600 / 60.0 results in 9 instead of 10, we will fix that.
MF-
Smart Inserter
Smart Inserter
Posts: 1235
Joined: Sun Feb 24, 2013 12:07 am
Contact:

Re: [0.4.0] Train stop delay time decrements by one

Post by MF- »

kovarex wrote:Now I understood the cause of the problem.
We are compiling the linux ship version with the -ffast-math, but we don't have it in debug version, so it was hard to find out.
With this options, it seems like 600 / 60.0 results in 9 instead of 10, we will fix that.
I though that the float math doesn't guarantee exact results.
How does one fix this? Use a rounding function instead of floor()? Add a small number to the "600" ?
kovarex
Factorio Staff
Factorio Staff
Posts: 8298
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [0.4.0] Train stop delay time decrements by one

Post by kovarex »

MF- wrote:
kovarex wrote:Now I understood the cause of the problem.
We are compiling the linux ship version with the -ffast-math, but we don't have it in debug version, so it was hard to find out.
With this options, it seems like 600 / 60.0 results in 9 instead of 10, we will fix that.
I though that the float math doesn't guarantee exact results.
How does one fix this? Use a rounding function instead of floor()? Add a small number to the "600" ?
The float does guarantee exact results as long as it follows the IEEE specification.
By exact results, I mean determnistic, same on all computers.
And about precision, due to the Standardized floating point specification, 600 / 60 should be really 10 precisely, I'm quite sure about that.
Our replay (and later multiplayer) will heavily depend on that, so we need to solve it globally, not just for this case, we will probably just just some "safe" subset of the math optimisations for the next release.
slpwnd
Factorio Staff
Factorio Staff
Posts: 1835
Joined: Sun Feb 03, 2013 2:51 pm
Contact:

Re: [0.4.0] Train stop delay time decrements by one

Post by slpwnd »

This was resolved by disabling the -ffast-math.
Post Reply

Return to “Resolved Problems and Bugs”