Use 'long long' integers in Rational class.

2008-09-26 Thread Adam Wilson
Neil and Han-Wen,

Thanks so much for the change to 64-bit!  I have tried the original test case I 
sent to the user list, and  it now compiles without error!  Also, I tried one of
the parts for the score I'm working on that was  similarly breaking, and it
seems to work fine, too.

Below is the test case that now works.  Thanks again!

Best,
Adam

===

\version "2.11.59"

\layout {
\context { \Score
\override NonMusicalPaperColumn #'line-break-permission = ##f
\override NonMusicalPaperColumn #'page-break-permission = ##f
\override SpacingSpanner #'uniform-stretching = ##t
\override SpacingSpanner #'strict-note-spacing = ##t
proportionalNotationDuration = #(ly:make-moment 1 20)
ragged-right = ##t
}
\context { \Voice
\remove Forbid_line_break_engraver
\override Beam #'breakable = ##t
}
}
\new Staff {
<<
\new Voice { 

\time 4/1
c'2.*2351/3696
\scaleDurations #'(495 . 4336) { 
d'8*11[ \bar "|" \break d'8*100 d'8*100]
}
e'1*827949/8012928
\bar "|"
\time 3/8 
c'4.

}
>>
}

%{
The error below now no longer occurs:
warning: unterminated beam d'8*11[ \bar "|" \break d'8*100 d'8*100]
===
[a=3696, b=34688 (denom. of 495/4366*211/8), c=8012928, d=8]
gcf(a,b,c,d) = 8
lcm(a,b,c,d) = 1027312242130944
32-bit precision maxes out at 4.3 billion (less than the lcm above)
64-bit is more like 18.4 quintillion
%}







___
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: Use 'long long' integers in Rational class.

2008-09-21 Thread Neil Puttock
2008/9/19 Han-Wen Nienhuys <[EMAIL PROTECTED]>:
> They appear if you use -Wall with compiling lilypond.  I'm on fedora
> 9, which has a pretty recent gcc though.

That's the default setting though, isn't it? I'm on Ubuntu hardy
x86_64, using gcc 4.2.3; the only warnings I've ever seen are from the
lexer concerning unmatched rules.

I've just tried compiling using gcc 4.3.2, and it differs only in
spitting out lots of warnings about type conversions altering value so
I'm none the wiser. :( Nevertheless, I've prepared a patch with your
suggestions (plus a few additions for moments and durations):
http://codereview.appspot.com/5889

Regards,
Neil


___
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: Use 'long long' integers in Rational class.

2008-09-18 Thread Han-Wen Nienhuys
They appear if you use -Wall with compiling lilypond.  I'm on fedora
9, which has a pretty recent gcc though.

On Thu, Sep 18, 2008 at 3:49 PM, Neil Puttock <[EMAIL PROTECTED]> wrote:
> 2008/9/18 Han-Wen Nienhuys <[EMAIL PROTECTED]>:
>> Neil, could you also fix the warnings that this change generated?  You
>> should use scm_from_int64, scm_to_int64 for conversions, otherwise
>> we'll get truncations in various corner cases.
>
> Sorry Han-Wen, I haven't seen any warnings.  Are they from Guile?
>
> Should the typedef be changed to int64_t if we're using the above type
> conversions, since they're for exact 64 bit integers?
>
> Regards,
> Neil
>



-- 
Han-Wen Nienhuys - [EMAIL PROTECTED] - http://www.xs4all.nl/~hanwen


___
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: Use 'long long' integers in Rational class.

2008-09-18 Thread Neil Puttock
2008/9/18 Han-Wen Nienhuys <[EMAIL PROTECTED]>:
> Neil, could you also fix the warnings that this change generated?  You
> should use scm_from_int64, scm_to_int64 for conversions, otherwise
> we'll get truncations in various corner cases.

Sorry Han-Wen, I haven't seen any warnings.  Are they from Guile?

Should the typedef be changed to int64_t if we're using the above type
conversions, since they're for exact 64 bit integers?

Regards,
Neil


___
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: Use 'long long' integers in Rational class.

2008-09-18 Thread Han-Wen Nienhuys
Neil, could you also fix the warnings that this change generated?  You
should use scm_from_int64, scm_to_int64 for conversions, otherwise
we'll get truncations in various corner cases.


On Fri, Sep 12, 2008 at 3:42 AM,  <[EMAIL PROTECTED]> wrote:
> LGTM
>
> please apply.
>
>
>
> http://codereview.appspot.com/5058/diff/11/12
> File flower/include/flower-proto.hh (right):
>
> http://codereview.appspot.com/5058/diff/11/12#newcode2
> Line 2: fflower-proto.hh -- typenames in flowerlib
> ff?
>
> http://codereview.appspot.com/5058
>



-- 
Han-Wen Nienhuys - [EMAIL PROTECTED] - http://www.xs4all.nl/~hanwen


___
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: Use 'long long' integers in Rational class.

2008-09-11 Thread hanwenn

LGTM

please apply.



http://codereview.appspot.com/5058/diff/11/12
File flower/include/flower-proto.hh (right):

http://codereview.appspot.com/5058/diff/11/12#newcode2
Line 2: fflower-proto.hh -- typenames in flowerlib
ff?

http://codereview.appspot.com/5058


___
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: Use 'long long' integers in Rational class.

2008-09-11 Thread Neil Puttock
2008/9/11 Han-Wen Nienhuys <[EMAIL PROTECTED]>:
> Go for it!

Revised patch is up.

OK to apply?

Regards,
Neil


___
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: Use 'long long' integers in Rational class.

2008-09-11 Thread Han-Wen Nienhuys
Go for it!

On Thu, Sep 11, 2008 at 1:21 PM,  <[EMAIL PROTECTED]> wrote:
> On 2008/09/09 22:18:07, hanwenn wrote:
>
>> I wonder if we should have a typedef long long, though.  Maybe int64
>
> or similar.
>
> Yes, it would be an improvement.
>
> We already have I64 in flower-proto.hh, so it would just be a case of
> adding a typedef unsigned long long.
>
> http://codereview.appspot.com/5058
>



-- 
Han-Wen Nienhuys - [EMAIL PROTECTED] - http://www.xs4all.nl/~hanwen


___
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: Use 'long long' integers in Rational class.

2008-09-11 Thread n . puttock

On 2008/09/09 22:18:07, hanwenn wrote:


I wonder if we should have a typedef long long, though.  Maybe int64

or similar.

Yes, it would be an improvement.

We already have I64 in flower-proto.hh, so it would just be a case of
adding a typedef unsigned long long.

http://codereview.appspot.com/5058


___
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel


Use 'long long' integers in Rational class.

2008-09-09 Thread hanwenn

Reviewers: Neil Puttock,

Message:
LGTM .

I wonder if we should have a typedef long long, though.  Maybe int64 or
similar.




Please review this at http://codereview.appspot.com/5058

Affected files:
  M flower/include/rational.hh
  M flower/include/std-string.hh
  M flower/include/string-convert.hh
  M flower/rational.cc
  M flower/std-string.cc
  M flower/string-convert.cc
  M lily/lily-guile.cc




___
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel