I&#39;m pretty sure there&#39;s a bug in the way ChucK prints time.  Or there may be a bug in the way I think.  Bear with me...<br><br>You would expect that two time values that print identically would compare as equal.  But I can show you a case where t0 and t1 print as &quot;44100.000000&quot; yet they&#39;re not equal.  You&#39;d also expect t1 to have a fractional part of 0.0.  But in this case:<br>
<br>   &lt;&lt;&lt; (t1 % 1::second) &gt;&gt;&gt; prints &quot;1.000000&quot;<br><br>and<br><br>   &lt;&lt;&lt; t1 - (t1 % 1::second) &gt;&gt;&gt; prints &quot;44099.000000&quot;<br><br>Mind you, I&#39;m NOT complaining about roundoff error -- I understand that converting between floats and time is subject to roundoff -- but it has certainly cost me a LOT of debugging time discovering that 44100.000000 != 44100.000000.  It&#39;s a printing bug.<br>
<br>Here&#39;s the code.  It&#39;s longer than it needs to be, so if anyone asks for it, I&#39;ll strip it down to a three line example.<br><br>// In ChucK, two times can appear to be equal when printed,<br>// but compare as not equal, as demonstrated here.<br>
<br>72.511111111 =&gt; float tempo;    // intentionally subject to roundoff<br><br>now =&gt; time t0;            // base time<br>100.0 =&gt; float b0;        // beat at t0<br>1::second / tempo =&gt; dur i0;    // duration of one beat<br>
<br>// convert from system time to beat<br>fun float time_to_beat(time t) { return b0 + (t - t0)/i0; }<br><br>// convert from beat to system time<br>fun time beat_to_time(float b) { return t0 + (b - b0)::i0; }<br><br>// for debugging: extract fractional and whole parts from time<br>
fun dur frac_time(time t) { return t % 1::samp; }<br>fun time whol_time(time t) { return t - (t % 1::samp); }<br><br>fun void test_time(time t0) {<br>    beat_to_time(time_to_beat(t0)) =&gt; time t1;<br>    if (t0 != t1) {<br>
    &lt;&lt;&lt; &quot;t0:&quot;,t0,&quot;is not equal to t1:&quot;,t1&gt;&gt;&gt;;<br>    frac_time(t0) =&gt; dur f0;<br>    frac_time(t1) =&gt; dur f1;<br>    whol_time(t0) =&gt; time w0;<br>    whol_time(t1) =&gt; time w1;<br>
    &lt;&lt;&lt; f0, f1, f0==f1, w0, w1, w0==w1 &gt;&gt;&gt;;<br>    }<br>}<br><br>test_time(now);<br>test_time(now+1::second);<br>test_time(now+1::samp);<br><br>