@@ -1786,6 +1786,12 @@ Function ceil examples
1786
1786
math . complex ( 3.3 , - 2.7 )
1787
1787
)
1788
1788
1789
+ // unit input
1790
+ const numCeiledUnit = math . ceil ( math . unit ( 3.2 , 'cm' ) , math . unit ( 'cm' ) )
1791
+ assert . deepStrictEqual ( numCeiledUnit , math . unit ( 4 , 'cm' ) )
1792
+ const numCeiledUnit1Dec = math . ceil ( math . unit ( 3.21 , 'cm' ) , 1 , math . unit ( 'cm' ) )
1793
+ assert . deepStrictEqual ( numCeiledUnit1Dec , math . unit ( 3.3 , 'cm' ) )
1794
+
1789
1795
// array input
1790
1796
assert . deepStrictEqual ( math . ceil ( [ 3.2 , 3.8 , - 4.7 ] ) , [ 4 , 4 , - 4 ] )
1791
1797
assert . deepStrictEqual ( math . ceil ( [ 3.21 , 3.82 , - 4.71 ] , 1 ) , [ 3.3 , 3.9 , - 4.7 ] )
@@ -1807,12 +1813,6 @@ Function ceil examples
1807
1813
math . fraction ( 6286 , 1000 )
1808
1814
] )
1809
1815
1810
- // unit input
1811
- const numCeiledUnit = math . ceil ( math . unit ( 3.2 , 'cm' ) , math . unit ( 'cm' ) )
1812
- assert . deepStrictEqual ( numCeiledUnit , math . unit ( 4 , 'cm' ) )
1813
- const numCeiledUnit1Dec = math . ceil ( math . unit ( 3.21 , 'cm' ) , 1 , math . unit ( 'cm' ) )
1814
- assert . deepStrictEqual ( numCeiledUnit1Dec , math . unit ( 3.3 , 'cm' ) )
1815
-
1816
1816
// @ts -expect-error ... verify ceil(array, array) throws an error (for now)
1817
1817
assert . throws ( ( ) => math . ceil ( [ 3.21 , 3.82 ] , [ 1 , 2 ] ) , TypeError )
1818
1818
}
@@ -1868,6 +1868,12 @@ Function fix examples
1868
1868
math . complex ( 3.2 , - 2.7 )
1869
1869
)
1870
1870
1871
+ // unit input
1872
+ const numCeiledUnit = math . fix ( math . unit ( 3.2 , 'cm' ) , math . unit ( 'cm' ) )
1873
+ assert . deepStrictEqual ( numCeiledUnit , math . unit ( 3 , 'cm' ) )
1874
+ const numCeiledUnit1Dec = math . fix ( math . unit ( 3.1 , 'cm' ) , 1 , math . unit ( 'cm' ) )
1875
+ assert . deepStrictEqual ( numCeiledUnit1Dec , math . unit ( 3.1 , 'cm' ) )
1876
+
1871
1877
// array input
1872
1878
assert . deepStrictEqual ( math . fix ( [ 3.2 , 3.8 , - 4.7 ] ) , [ 3 , 3 , - 4 ] )
1873
1879
assert . deepStrictEqual ( math . fix ( [ 3.21 , 3.82 , - 4.71 ] , 1 ) , [ 3.2 , 3.8 , - 4.7 ] )
@@ -1944,6 +1950,12 @@ Function floor examples
1944
1950
math . complex ( 3.2 , - 2.8 )
1945
1951
)
1946
1952
1953
+ // unit input
1954
+ const numCeiledUnit = math . floor ( math . unit ( 3.2 , 'cm' ) , math . unit ( 'cm' ) )
1955
+ assert . deepStrictEqual ( numCeiledUnit , math . unit ( 3 , 'cm' ) )
1956
+ const numCeiledUnit1Dec = math . floor ( math . unit ( 3.1 , 'cm' ) , 1 , math . unit ( 'cm' ) )
1957
+ assert . deepStrictEqual ( numCeiledUnit1Dec , math . unit ( 3.1 , 'cm' ) )
1958
+
1947
1959
// array input
1948
1960
assert . deepStrictEqual ( math . floor ( [ 3.2 , 3.8 , - 4.7 ] ) , [ 3 , 3 , - 5 ] )
1949
1961
assert . deepStrictEqual ( math . floor ( [ 3.21 , 3.82 , - 4.71 ] , 1 ) , [ 3.2 , 3.8 , - 4.8 ] )
0 commit comments