develooper Front page | perl.perl6.language | Postings from June 2005

Re: mod/div

Thread Previous | Thread Next
From:
Roger Hale
Date:
June 6, 2005 06:16
Subject:
Re: mod/div
Message ID:
20050606122542.13368.qmail@lists.develooper.com
Just a nit, for the record, with no great perl relevance:

"TSa (Thomas SandlaƟ)" wrote:
> But what is the first quarter of year 0? 0.25? 
Sure (of course if there were a year 0 instead of becoming 1 BCE)

 > And the last quarter of year -1? -0.25?
Sure

 > That works numerically, but March of a
> year is then not always the same difference to the start of the year, 
but you seem to have changed the question (first quarter to last
quarter) but called both quarters March?

rather:
[>] And the _first_ quarter of year -1? -0.75?
Sure
[>] That works numerically, _and_ March of a
[>] year is then _ always the same difference to the start of the year,
(although it's the end of March and April Fool's Day (yyyy-04-01) that's
a quarter after New Year's Day.)

[> although written differently as a decimal substring; two's
 > complement numbers with positive fractions do this better, being 0b.01
 > in both cases.] paraphrasing

>>  It lets me do things without bounds checking and
>> correct the ranges later, because, e.g., plugging in January -20, 0 AD
>> yields the correct result for December 11, 2 BC.  Such calculations break
>> dramatically across 0 if you use the definition found in some C
>> implementations, where (-3 mod 5) == -3.
(Note that this recognizes that 0 CE == 1 BCE, and that January -20
brings you back into the previous December.)

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About