All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Vivier <lvivier@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
	kvm@vger.kernel.org, kvm-ppc@vger.kernel.org
Cc: drjones@redhat.com, thuth@redhat.com, dgibson@redhat.com
Subject: Re: [kvm-unit-tests PATCH] powerpc: Add tests for RTAS
Date: Thu, 03 Mar 2016 13:02:01 +0000	[thread overview]
Message-ID: <56D835C9.5060506@redhat.com> (raw)
In-Reply-To: <56D831E5.2030604@redhat.com>



On 03/03/2016 13:45, Paolo Bonzini wrote:
> 
> 
> On 03/03/2016 13:28, Laurent Vivier wrote:
>> +
>> +#define DAYS(y,m,d) (365UL * (y) + ((y) / 4) - ((y) / 100) + ((y) / 400) + \
>> +		     367UL * (m) / 12  + \
> 
> Out of curiosity, where did you take this from?  I knew the variant with
> 2447/80 instead of 367/12, but they give the same result, as checked
> with bc:

Some ideas from:
http://www.cantab.net/users/michael.behrend/algorithms/easter/pages/main.html

30*m + (7*(m+1) / 12)

reduced into

(360m + 7m + 7)/12 -> 367m/12

Laurent

> $ bc
> for (n=1;n<\x12;n++)2447*n/80-367*n/12;
> 0
> 0
> 0
> 0
> 0
> 0
> 0
> 0
> 0
> 0
> 0
> 0
> 
> Paolo
> 
>> +		     (d))
>> +

WARNING: multiple messages have this Message-ID (diff)
From: Laurent Vivier <lvivier@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
	kvm@vger.kernel.org, kvm-ppc@vger.kernel.org
Cc: drjones@redhat.com, thuth@redhat.com, dgibson@redhat.com
Subject: Re: [kvm-unit-tests PATCH] powerpc: Add tests for RTAS
Date: Thu, 3 Mar 2016 14:02:01 +0100	[thread overview]
Message-ID: <56D835C9.5060506@redhat.com> (raw)
In-Reply-To: <56D831E5.2030604@redhat.com>



On 03/03/2016 13:45, Paolo Bonzini wrote:
> 
> 
> On 03/03/2016 13:28, Laurent Vivier wrote:
>> +
>> +#define DAYS(y,m,d) (365UL * (y) + ((y) / 4) - ((y) / 100) + ((y) / 400) + \
>> +		     367UL * (m) / 12  + \
> 
> Out of curiosity, where did you take this from?  I knew the variant with
> 2447/80 instead of 367/12, but they give the same result, as checked
> with bc:

Some ideas from:
http://www.cantab.net/users/michael.behrend/algorithms/easter/pages/main.html

30*m + (7*(m+1) / 12)

reduced into

(360m + 7m + 7)/12 -> 367m/12

Laurent

> $ bc
> for (n=1;n<=12;n++)2447*n/80-367*n/12;
> 0
> 0
> 0
> 0
> 0
> 0
> 0
> 0
> 0
> 0
> 0
> 0
> 
> Paolo
> 
>> +		     (d))
>> +

  reply	other threads:[~2016-03-03 13:02 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-25 21:19 [kvm-unit-tests PATCH] powerpc: Add tests for sPAPR h-calls Thomas Huth
2016-02-25 21:19 ` Thomas Huth
2016-02-29  0:38 ` David Gibson
2016-02-29  0:38   ` David Gibson
2016-03-03 12:28 ` [kvm-unit-tests PATCH] powerpc: Add tests for RTAS Laurent Vivier
2016-03-03 12:28   ` Laurent Vivier
2016-03-03 12:45   ` Paolo Bonzini
2016-03-03 12:45     ` Paolo Bonzini
2016-03-03 13:02     ` Laurent Vivier [this message]
2016-03-03 13:02       ` Laurent Vivier
2016-03-03 16:03   ` Radim Krčmář
2016-03-03 16:03     ` Radim Krčmář
2016-03-03 16:29     ` Paolo Bonzini
2016-03-03 16:29       ` Paolo Bonzini
2016-03-03 17:09       ` Radim Krčmář
2016-03-03 17:09         ` Radim Krčmář
2016-03-03 17:12         ` Paolo Bonzini
2016-03-03 17:12           ` Paolo Bonzini
2016-03-03 17:17           ` Radim Krčmář
2016-03-03 17:17             ` Radim Krčmář
2016-03-03 16:54   ` Thomas Huth
2016-03-03 16:54     ` Thomas Huth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56D835C9.5060506@redhat.com \
    --to=lvivier@redhat.com \
    --cc=dgibson@redhat.com \
    --cc=drjones@redhat.com \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.