math: fix docs for next-power-of-2 and some tests.

db4
John Benediktsson 2014-02-06 17:23:54 -08:00
parent 986714489d
commit ede21dfb56
2 changed files with 8 additions and 1 deletions

View File

@ -407,7 +407,7 @@ HELP: number
HELP: next-power-of-2
{ $values { "m" "a non-negative integer" } { "n" "an integer" } }
{ $description "Outputs the smallest power of 2 greater than " { $snippet "m" } ". The output value is always at least 2." } ;
{ $description "Outputs the smallest power of 2 greater than or equal to " { $snippet "m" } ". The output value is always at least 2." } ;
HELP: power-of-2?
{ $values { "n" integer } { "?" "a boolean" } }

View File

@ -86,3 +86,10 @@ IN: math.tests
{ -0x3fffffffffffffff } [ 0x3ffffffffffffffe >bignum bitnot ] unit-test
{ -0x4000000000000000 } [ 0x3fffffffffffffff >bignum bitnot ] unit-test
{ -0x4000000000000001 } [ 0x4000000000000000 >bignum bitnot ] unit-test
{ 2 } [ 0 next-power-of-2 ] unit-test
{ 2 } [ 1 next-power-of-2 ] unit-test
{ 2 } [ 2 next-power-of-2 ] unit-test
{ 4 } [ 3 next-power-of-2 ] unit-test
{ 4 } [ 4 next-power-of-2 ] unit-test
{ 8 } [ 5 next-power-of-2 ] unit-test