1 ! Copyright (C) 2017 Jon Harper.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: help.markup help.syntax kernel math quotations ;
4 IN: math.functions.integer-logs
8 { "x" "a positive rational number" }
11 { $description "Outputs the largest integer " { $snippet "n" } " such that " { $snippet "10^n" } " is less than or equal to " { $snippet "x" } "." }
12 { $errors "Throws an error if " { $snippet "x" } " is zero or negative." } ;
16 { "x" "a positive rational number" }
19 { $description "Outputs the largest integer " { $snippet "n" } " such that " { $snippet "2^n" } " is less than or equal to " { $snippet "x" } "." }
20 { $errors "Throws an error if " { $snippet "x" } " is zero or negative." } ;
22 ARTICLE: "integer-logs" "Integer logarithms"
23 "The " { $vocab-link "math.functions.integer-logs" } " vocabulary provides exact integer logarithms for all rational numbers:"
24 { $subsections integer-log2 integer-log10 }
27 "USING: prettyprint math.functions.integer-logs sequences ;"
29 " 5 99 100 101 100000000000000000000"
31 "} [ integer-log10 ] map ."