<Sigma88>
I'm just trying to find a different way to account for the fact that one year cannot be divided in an integer number of days
<UmbralRaptor>
!wpn -add:wpn banana
<Qboid>
UmbralRaptor: Weapon added!
<Sigma88>
ur thanks
<Sigma88>
!wpn -add:adj peeled
<Qboid>
Sigma88: Adjective added!
<Sigma88>
!wpn -add:adj Gregrox'd
<Qboid>
Sigma88: Adjective added!
<GregroxMun>
what could a Gregrox'd weapon be?
<GregroxMun>
!wpn
* Qboid
gives GregroxMun a semigroup/superpower hybrid
<GregroxMun>
!wpn
* Qboid
gives GregroxMun a surprise threaded product
<GregroxMun>
!wpn
* Qboid
gives GregroxMun an astronomer/cocycle hybrid
<GregroxMun>
!wpn
* Qboid
gives GregroxMun a stochastic memory which vaguely resembles a projection
<Sigma88>
GregroxMun: you seem a smart guy
<GregroxMun>
oh thank you
<Sigma88>
what's the best way to calculate how many years pass in a certain amount of time
<Sigma88>
keeping in mind that once in a while there's a leap year
<Sigma88>
I need to calculate that knowing:
<Sigma88>
1- the time passed
<Sigma88>
2- the length of a year
<Sigma88>
3- the length of a day
<GregroxMun>
I'm afraid I haven't got a clue.
<Sigma88>
it feels like it should be very easy
<GregroxMun>
I would normally just do the simple time to seconds, mult by 60, 60, 24, 365.
<Sigma88>
I need to do the opposite
<Sigma88>
I have the seconds, need to get the years and days
<Sigma88>
so like, 3 million seconds how many years / days are?
<GregroxMun>
well there's a leap year every four years except for years divisible by 100, unless again they will if they are divisible by 400.
<Sigma88>
no
<Sigma88>
not real leap year
<Sigma88>
s
<GregroxMun>
we want average year length, right?
<GregroxMun>
I don't know
<Sigma88>
just end the year early when there's not enough time left to fit another day
<GregroxMun>
I have no clue
<Sigma88>
so, assume you have years = 365.25
<Sigma88>
and days = 1
<Sigma88>
after 365 days you don't have enough left in the year to make another day
<Sigma88>
(0.25)
<Sigma88>
so the next day will be the first day of the next year
<Sigma88>
same for year2 (you remain with 0.5)
<Sigma88>
same for year3 (you remain with 0.75)
<Sigma88>
in year 4 you have enough to fit an extra day, so you get Y4D365 > Y4D366 > Y5D1
* UmbralRaptor
seems to recall recall that Gregorian years are exactly 365.2425 days. Julian years are exactly 365.25 days. Both of those use mean solar(?) days of exactly 86400 seconds.
<UmbralRaptor>
But, depending on precision, it may be necessary to ask what you mean by "day" and "year"
<UmbralRaptor>
You can also consult with egg|afk|egg for additional temporal madness.
<Sigma88>
UmbralRaptor:
<Sigma88>
basically, it's a math problem
<Sigma88>
my definition of day is just a certain time period
<Sigma88>
say 24 hrs
<Sigma88>
and a year is another time period
<Sigma88>
say (365.25 * 24)hrs
<Sigma88>
in this case you can't divide 1 year in an integer number of days
<Sigma88>
(you are left with a quarter of day at the end of 365 days, to complete the year)
<Sigma88>
now, I want to translate x hours to years and days
<Sigma88>
which means that I need an algorithm that with the input: "24 hrs" will spew out "0 years, 1 day"
<Sigma88>
48hrs ==> 0 y, 2d
<Sigma88>
365 * 24 hrs ==> 1 year. 0 days
<Sigma88>
4*365*24 hrs ==> 3 years, 365 days
<Sigma88>
(because that's a leap year)
<Sigma88>
where "leap" means that you have enough time left from previous years to to make an extra day
UmbralRaptor is now known as QuantizedRaptor
<QuantizedRaptor>
hrm
<Sigma88>
it sounds like it should be easy
<Sigma88>
but there's something I'm missing
<Sigma88>
the only solutions I can come up with are flawed
<QuantizedRaptor>
Mainly an epoch offset?
<Sigma88>
don't think it in terms of days and years
<Sigma88>
think of it like it's something else
<Sigma88>
ok I found a solution
<Sigma88>
it's very ugly
<Sigma88>
but it should work
Thomas|AWAY is now known as Thomas
* QuantizedRaptor
assume you need some sort of offset to know how far you are from the next leap year.
<Thomas>
It is funny that literally all people who have problems with exploding vessels and solar panels are using KSS
<QuantizedRaptor>
Bur ignoring that, something like floor(time/year_length) = number of years, floor((time - number_of_years*year_length)/day_length) = number of days
<QuantizedRaptor>
exploding solar panels?
<Sigma88>
what's floor?
<Sigma88>
!c Math.Floor(0.5)
<Qboid>
0
<Sigma88>
!c Math.Floor(115.5)
<Qboid>
115
<QuantizedRaptor>
rounding down to the nearest int
<Sigma88>
so it's just (int)(0.5) ?
<Sigma88>
!c (int)(115.5)
<Qboid>
115
<QuantizedRaptor>
!c Math.floor(1.9)
<Qboid>
(1,7): error CS0117: `System.Math' does not contain a definition for `floor'/usr/lib/mono/4.5/mscorlib.dll (Location of the symbol related to previous error)
<Sigma88>
F
<Sigma88>
capital F
<QuantizedRaptor>
FFFFFF
<Sigma88>
:)
<QuantizedRaptor>
!c Math.Floor(1.9)
<Qboid>
1
<Sigma88>
!c (int)(1.9)
<Qboid>
1
<Sigma88>
why would anything like that exist?
<QuantizedRaptor>
yeah, truncation
<QuantizedRaptor>
It seems useful in this case. More generally, sometimes you just want to discard bits, especially the part of a number after the decimal?
<Sigma88>
I don't mean the truncation
<Sigma88>
I mean, why would you use Math.Floor, instead of just (int)
<Sigma88>
the result is the same
<Sigma88>
much less characters to type
<Sigma88>
:D
<Thomas>
Because Floor returns a double, and if you want to continue with that, you dont need to cast it again
<Thomas>
(double)(int)115.5 would be silly and unefficient
<QuantizedRaptor>
Insufficient familiarity with c#, though apparently it's the right thing?
<Sigma88>
ah
<Sigma88>
!c (double)(int)(0.5)
<Qboid>
0
<Sigma88>
!c 0.5*(int)(11.5)
<Qboid>
5.5
<Sigma88>
!c 1/2*(int)(11.5)
<Qboid>
0
<Sigma88>
ok so that's the only case where it might differ
<Sigma88>
!c 1/2*Math.Floor(11.5)
<Qboid>
0
<Sigma88>
wait wut?
<Thomas>
You are doing 1/22
<Thomas>
Which is 0 in integer world
<Sigma88>
!c 1/2*double(5.5)
<Qboid>
(1,11): error CS1525: Unexpected symbol `(', expecting `.'
<Sigma88>
!c 1/2*(double)(5.5)
<Qboid>
0
<Thomas>
!c (1/2)*Math.Floor(11.5)
<Qboid>
0
<Thomas>
Hmm
<Thomas>
Now I am confused :P
<Sigma88>
that's what I'm saying
<Thomas>
!c Math.Floor(11.5)/2
<Qboid>
5.5
<Sigma88>
I thought that having a double in there was enough to make 1/2 equal 0.5
<Thomas>
Ah, wait
<Thomas>
1 / 2 is 0 in int world
<Thomas>
1d / 2d is 0.5
<Thomas>
!c (1d/2)*Math.Floor(11.5)
<Qboid>
5.5
<Sigma88>
!c 1/(2/Math.Floor(11.5))
<Qboid>
5.5
<Sigma88>
ok
<Sigma88>
!c 1/(2/(int)(11.5))
<Qboid>
(1,2): error CS0020: Division by constant zero
<Sigma88>
ok
<Sigma88>
so that's the only way to get a different result between (int) and floor
<Sigma88>
egg|afk|egg: I need your brainpower
<Sigma88>
:D
<Sigma88>
I feel like this is a trivial problem and I'm just missing some obvious relationship
<Thomas>
!c 2/11
<Qboid>
0
<Thomas>
!c 2d/11
<Qboid>
0.181818181818182
Olympic1 is now known as Olympic1|Away
<Sigma88>
thomas, do you know how I could solve my issue?
<Thomas>
issue?
<Sigma88>
it's a mathematical problem
<Sigma88>
basically, for the kronometer
<Sigma88>
I want to add a new way to handle "years that do not divide in an integer number of days"
<Sigma88>
so, basically, when a day ends, if the time left to complete the year is not enough to fit another day, then we move on to the next year
<Sigma88>
example:
<Sigma88>
if one year lasts 365.25 days
<Sigma88>
at the end of day 365, we skip to year 2
<Sigma88>
after a while, the extra time that carries over from past years will be enough to make a new day
<Sigma88>
so you get one extra day in the year
Galileo88 has joined #Kopernicus
<Sigma88>
I am failing in defining the math to get year and day from a give number of time passed
<Sigma88>
Thomas: let me know if I have to explain it in more detail
Galileo88 has quit [Client Quit]
<Sigma88>
this is becoming silly
Gameslinx has joined #Kopernicus
<Gameslinx>
Hey all :)
<Gameslinx>
I have another question regarding terrain scatters
<Gameslinx>
Wait... Lemme investigate more, still unsure