We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c53457f commit 3fc901bCopy full SHA for 3fc901b
1 file changed
tunits/core/cython/frac.pyx
@@ -85,8 +85,10 @@ cpdef frac float_to_twelths_frac(a) except *:
85
86
cdef double d = float(a)
87
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:
+ if 12*d - x > 1e-5:
+ print(12*d - x)
90
+ print(12*d - <long long>(12*d))
91
+ print(<long long>(12*d), x)
92
raise ValueError("Not a twelfth.")
93
94
return frac_least_terms(x, 12)
0 commit comments