Skip to content

Commit 3e474d7

Browse files
use cmath.fabs
1 parent 08433e7 commit 3e474d7

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
strategy:
6868
fail-fast: false
6969
matrix:
70-
os: ["ubuntu-24.04", "ubuntu-24.04-arm", "windows-2022" , "macos-13", "macos-14"]
70+
os: ["ubuntu-24.04-arm"] #["ubuntu-24.04", "ubuntu-24.04-arm", "windows-2022" , "macos-13", "macos-14"]
7171

7272
runs-on: ${{ matrix.os }}
7373

tunits/core/cython/frac.pyx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
# limitations under the License.
1414

1515
cimport cython
16-
from libc.math cimport floor as c_floor, pow as c_pow
17-
16+
from libc.math cimport floor as c_floor, pow as c_pow, fabs as c_fabs
1817

1918
# A ratio that should always be canonicalized into least terms with the sign
2019
# on the numerator.
@@ -86,7 +85,7 @@ cpdef frac float_to_twelths_frac(a) except *:
8685

8786
cdef double d = float(a)
8887
cdef long long x = <long long>c_floor(12*d + 0.5)
89-
if abs(12*d - x) > 1e-5:
88+
if fabs(12*d - x) > 1e-5:
9089
print('spit', d, x, 12*d - x, a, '%.20f'%d, '%.20f'%a, '%.20f'%(12*d))
9190
raise ValueError("Not a twelfth.")
9291

0 commit comments

Comments
 (0)