Skip to content

Commit 3fc901b

Browse files
add debug
1 parent c53457f commit 3fc901b

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

tunits/core/cython/frac.pyx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,10 @@ cpdef frac float_to_twelths_frac(a) except *:
8585

8686
cdef double d = float(a)
8787
cdef long long x = <long long>c_floor(12*d + 0.5)
88-
cdef double y = 12*d
89-
if y - <long long>c_floor(y) > 1e-5:
88+
if 12*d - x > 1e-5:
89+
print(12*d - x)
90+
print(12*d - <long long>(12*d))
91+
print(<long long>(12*d), x)
9092
raise ValueError("Not a twelfth.")
9193

9294
return frac_least_terms(x, 12)

0 commit comments

Comments
 (0)