Re: Confused by zero moments

Lukas-Fabian Moser via Discussions on LilyPond development <[email protected]> Sun, 12 Jul 2026 18:33:26 +0200
Newsgroups gmane.comp.gnu.lilypond.devel
Message-ID <[email protected]>
Hi Harm,

> consider the following:
> musicI =3D {}
> musicII =3D {}
>
> Obviouslyly:music-length returns #<Mom 0> for both:
> #(pretty-print (ly:music-length musicI))
> #(pretty-print (ly:music-length musicII))
>
> Why the result of below is different:
> #(pretty-print
>    (ly:moment-div (ly:music-length musicI) (ly:music-length musicII)))
> -> #<Mom 0>
> #(pretty-print
>     (ly:moment-div ZERO-MOMENT ZERO-MOMENT))
> -> #<Mom nanGinfinity>

Probably Dan will be able to say more about this; I just want to give a=20
maybe concise data point:

\version "2.22" music =3D {} #(define ZERO (ly:music-length music))=20
#(pretty-print (equal? ZERO ZERO-MOMENT)) #(pretty-print (ly:moment-div=20
ZERO ZERO-MOMENT)) #(pretty-print (ly:moment-div ZERO ZERO))=20
#(pretty-print (ly:moment-div ZERO-MOMENT ZERO)) #(pretty-print=20
(ly:moment-div ZERO-MOMENT ZERO-MOMENT))

yields with 2.22.1:

#t #<Mom 0> #<Mom 0> #<Mom 0> #<Mom 0> and with 2.26.0: #t #<Mom=20
infinityGinfinity> #<Mom 0> #<Mom 0> #<Mom nanGinfinity>

Lukas