Difference between revisions of "Talk:Function for Time of Day"
imported>Cipscis |
imported>Rasikko |
||
(6 intermediate revisions by 3 users not shown) | |||
Line 4: | Line 4: | ||
-- [[User:Cipscis|Cipscis]] 15:43, 22 February 2012 (EST) | -- [[User:Cipscis|Cipscis]] 15:43, 22 February 2012 (EST) | ||
True, it's an educated guess. Floor() functions (and to a certain extent entire Math libraries) are notoriously slow in all languages, because they have to return correctly in all circumstances. The int cast will work in this case, because: 1) the number of game days passed should never exceed to max value of an integer, and 2) The number of game days passed will always be a positive number. | |||
EDIT: There doesn't seem to be any way to really test this ingame. I get strange and inconsistent results for measuring the passage of small amounts of time, and I think it's because of the game's implementation of floating point numbers. | |||
So, I'll change the main page back in light of no evidence to prove my case :D | |||
You win this time, Cipscis!!! <shakes fist in the air> haha | |||
-- [[User:Daemonjax|Daemonjax]] | |||
: I'm lateeee to the party, but rather one is faster or not, casting to int also allows one to avoid using a function call. Thus, this function could have only needed [GetCurrentGameTime - Utility]. --[[User:Rasikko|Rasikko]] ([[User talk:Rasikko|talk]]) 2018-02-11T08:46:34 (EST) | |||
== The other time functions. == | |||
[[Complete Example Scripts]] also has some time related functions to look at and possibly consolidate. I know [[User:Rasikko]] has been working on these lately, maybe its useful? [[User:Scrivener07|Scrivener07]] ([[User talk:Scrivener07|talk]]) 2018-02-14T10:00:38 (EST) | |||
: Mine wont be complete for a while. Trying to get the current day without the global really wore my brain down, especially after discovering that fast traveling can potentially break day of the week system(hard to explain at this time). --[[User:Rasikko|Rasikko]] ([[User talk:Rasikko|talk]]) 2018-02-15T14:37:54 (EST) |
Latest revision as of 14:37, 15 February 2018
Casting float to int faster than Math.Floor[edit source]
I'd be very interested to know where this came from. Was there a test that was run, or is it just an educated guess based on the performance of other languages? If there was a test, I'd be really interested in the details of how it was run and what its results were.
-- Cipscis 15:43, 22 February 2012 (EST)
True, it's an educated guess. Floor() functions (and to a certain extent entire Math libraries) are notoriously slow in all languages, because they have to return correctly in all circumstances. The int cast will work in this case, because: 1) the number of game days passed should never exceed to max value of an integer, and 2) The number of game days passed will always be a positive number.
EDIT: There doesn't seem to be any way to really test this ingame. I get strange and inconsistent results for measuring the passage of small amounts of time, and I think it's because of the game's implementation of floating point numbers.
So, I'll change the main page back in light of no evidence to prove my case :D
You win this time, Cipscis!!! <shakes fist in the air> haha
-- Daemonjax
- I'm lateeee to the party, but rather one is faster or not, casting to int also allows one to avoid using a function call. Thus, this function could have only needed [GetCurrentGameTime - Utility]. --Rasikko (talk) 2018-02-11T08:46:34 (EST)
The other time functions.[edit source]
Complete Example Scripts also has some time related functions to look at and possibly consolidate. I know User:Rasikko has been working on these lately, maybe its useful? Scrivener07 (talk) 2018-02-14T10:00:38 (EST)