]> gitweb.factorcode.org Git - factor.git/blobdiff - core/math/math-docs.factor
use radix literals
[factor.git] / core / math / math-docs.factor
index 44420951fbf1f6ae873ca8342da9c60e5518364b..a3d252495d71d88afc5bccf5075c8e3a97802703 100644 (file)
@@ -147,8 +147,8 @@ HELP: bitand
 { $values { "x" integer } { "y" integer } { "z" integer } }
 { $description "Outputs a new integer where each bit is set if and only if the corresponding bit is set in both inputs." }
 { $examples
-    { $example "USING: math prettyprint ;" "BIN: 101 BIN: 10 bitand .b" "0" }
-    { $example "USING: math prettyprint ;" "BIN: 110 BIN: 10 bitand .b" "10" }
+    { $example "USING: math prettyprint ;" "0b101 0b10 bitand .b" "0" }
+    { $example "USING: math prettyprint ;" "0b110 0b10 bitand .b" "10" }
 }
 { $notes "This word implements bitwise and, so applying it to booleans will throw an error. Boolean and is the " { $link and } " word." } ;
 
@@ -156,8 +156,8 @@ HELP: bitor
 { $values { "x" integer } { "y" integer } { "z" integer } }
 { $description "Outputs a new integer where each bit is set if and only if the corresponding bit is set in at least one of the inputs." }
 { $examples
-    { $example "USING: math prettyprint ;" "BIN: 101 BIN: 10 bitor .b" "111" }
-    { $example "USING: math prettyprint ;" "BIN: 110 BIN: 10 bitor .b" "110" }
+    { $example "USING: math prettyprint ;" "0b101 0b10 bitor .b" "111" }
+    { $example "USING: math prettyprint ;" "0b110 0b10 bitor .b" "110" }
 }
 { $notes "This word implements bitwise inclusive or, so applying it to booleans will throw an error. Boolean inclusive or is the " { $link and } " word." } ;
 
@@ -165,15 +165,15 @@ HELP: bitxor
 { $values { "x" integer } { "y" integer } { "z" integer } }
 { $description "Outputs a new integer where each bit is set if and only if the corresponding bit is set in exactly one of the inputs." }
 { $examples
-    { $example "USING: math prettyprint ;" "BIN: 101 BIN: 10 bitxor .b" "111" }
-    { $example "USING: math prettyprint ;" "BIN: 110 BIN: 10 bitxor .b" "100" }
+    { $example "USING: math prettyprint ;" "0b101 0b10 bitxor .b" "111" }
+    { $example "USING: math prettyprint ;" "0b110 0b10 bitxor .b" "100" }
 }
 { $notes "This word implements bitwise exclusive or, so applying it to booleans will throw an error. Boolean exclusive or is the " { $link xor } " word." } ;
 
 HELP: shift
 { $values { "x" integer } { "n" integer } { "y" integer } }
 { $description "Shifts " { $snippet "x" } " to the left by " { $snippet "n" } " bits if " { $snippet "n" } " is positive, or " { $snippet "-n" } " bits to the right if " { $snippet "n" } " is negative. A left shift of a fixnum may overflow, yielding a bignum. A right shift may result in bits “falling off” the right hand side and being discarded." }
-{ $examples { $example "USING: math prettyprint ;" "BIN: 101 5 shift .b" "10100000" } { $example "USING: math prettyprint ;" "BIN: 11111 -2 shift .b" "111" } } ;
+{ $examples { $example "USING: math prettyprint ;" "0b101 5 shift .b" "10100000" } { $example "USING: math prettyprint ;" "0b11111 -2 shift .b" "111" } } ;
 
 HELP: bitnot
 { $values { "x" integer } { "y" integer } }
@@ -185,7 +185,7 @@ $nl
 HELP: bit?
 { $values { "x" integer } { "n" integer } { "?" "a boolean" } }
 { $description "Tests if the " { $snippet "n" } "th bit of " { $snippet "x" } " is set." }
-{ $examples { $example "USING: math prettyprint ;" "BIN: 101 2 bit? ." "t" } } ;
+{ $examples { $example "USING: math prettyprint ;" "0b101 2 bit? ." "t" } } ;
 
 HELP: log2
 { $values { "x" "a positive integer" } { "n" integer } }