We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 26a6995 commit c53457fCopy full SHA for c53457f
1 file changed
tunits/core/cython/frac.pyx
@@ -85,15 +85,8 @@ 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 diff = x
89
- diff -= 12*d
90
- if max(diff, -diff) > 1e-5:
91
- print('spit')
92
- print('%.20f'%a)
93
- print('%.20f'%d)
94
- print('%.20f'%(12*d))
95
- print(x)
96
- print('%.20f'%diff)
+ cdef double y = 12*d
+ if y - <long long>c_floor(y) > 1e-5:
97
raise ValueError("Not a twelfth.")
98
99
return frac_least_terms(x, 12)
0 commit comments