(html (head (title "sph-lib (sph number)") (link (@ (rel "stylesheet") (type "text/css") (href "/css/sph.css"))) (meta (@ (name "viewport") (content "width=device-width,initial-scale=1"))) #f) (body () (div (@ (class top)) (nav (a (@ (href "/")) "start") ", " (a (@ (href "/feed.xml")) "feed")) "") (div (@ (class "middle")) (div (@ (class mtime) (title "last modification time of the current page")) "2023-04-05") (section (h1 "(sph number)") (div "" (p "part of " (a (@ (href "../../sph-lib.html")) "sph-lib")) (#f (section (@ (class "library-name")) (h1 "module name") (p "(sph number)")) (section (@ (class "library-exports")) (h1 "exported bindings") (div (div (@ (class "doc-bindings")) (div (@ (id "doc-b-" "bit->byte-length") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "bit->byte-length") " " (span (@ (class "first-sig")) "a ->")) (div (@ (class "rest-sig")) (div "integer -> integer")) (div (@ (class "description")) (("calculate the bytes required to store the number of bits")))) (div (@ (id "doc-b-" "bound") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "bound") " " (span (@ (class "first-sig")) "n min max ->")) (div (@ (class "rest-sig")) (div "number number -> number")) (div (@ (class "description")) (("if n is smaller than min, return min." (br) "if n is greater than max, return max")))) (div (@ (id "doc-b-" "bound-max") (class "doc-b")) (div (span (@ (class "type")) "syntax") ": " (span (@ (class "name")) "bound-max") " " (span (@ (class "first-sig")) "a max")) "" "") (div (@ (id "doc-b-" "bound-min") (class "doc-b")) (div (span (@ (class "type")) "syntax") ": " (span (@ (class "name")) "bound-min") " " (span (@ (class "first-sig")) "a min")) "" "") (div (@ (id "doc-b-" "call-with-product-then-divide") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "call-with-product-then-divide") " " (span (@ (class "first-sig")) "f a factor ->")) (div (@ (class "rest-sig")) (div "procedure:{number -> number} number number -> number")) (div (@ (class "description")) (("call f with \\\"a\\\" multiplied by factor and afterwards divide by factor")))) (div (@ (id "doc-b-" "container-length->number-max") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "container-length->number-max") " " (span (@ (class "first-sig")) "digit-count base ->")) (div (@ (class "rest-sig")) (div "integer integer -> integer")) (div (@ (class "description")) (("calculate the maximum value that can represented with the given number of digits in the given base")))) (div (@ (id "doc-b-" "decrement-one") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "decrement-one") " " (span (@ (class "first-sig")) "a ->")) "" "") (div (@ (id "doc-b-" "float-modulo") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "float-modulo") " " (span (@ (class "first-sig")) "a b ->")) "" (div (@ (class "description")) (("modulo for float values. fmod")))) (div (@ (id "doc-b-" "float-nearly-equal") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "float-nearly-equal") " " (span (@ (class "first-sig")) "a b margin ->")) "" (div (@ (class "description")) (("approximate float comparison. margin specifies the greatest accepted difference")))) (div (@ (id "doc-b-" "float-sum") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "float-sum") " " (span (@ (class "first-sig")) "a ... ->")) "" (div (@ (class "description")) (("return the sum of the given numbers calculated with rounding error compensation." (br) "uses kahan summation with neumaier modification")))) (div (@ (id "doc-b-" "fraction") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "fraction") " " (span (@ (class "first-sig")) "a ->")) "" "") (div (@ (id "doc-b-" "in-between?") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "in-between?") " " (span (@ (class "first-sig")) "n start end ->")) (div (@ (class "rest-sig")) (div "number number number -> boolean")) (div (@ (class "description")) (("true if n is between and not equal to num-start or num-end")))) (div (@ (id "doc-b-" "in-range?") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "in-range?") " " (span (@ (class "first-sig")) "n start end ->")) (div (@ (class "rest-sig")) (div "number number number -> boolean")) (div (@ (class "description")) (("true if n is between or equal to start or end")))) (div (@ (id "doc-b-" "increment-one") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "increment-one") " " (span (@ (class "first-sig")) "a ->")) "" "") (div (@ (id "doc-b-" "integer-and-fraction") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "integer-and-fraction") " " (span (@ (class "first-sig")) "a c ->")) "" "") (div (@ (id "doc-b-" "log-base") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "log-base") " " (span (@ (class "first-sig")) "a base ->")) (div (@ (class "rest-sig")) (div "number number -> number")) (div (@ (class "description")) (("result in the logarithm with \\\"base\\\" of \\\"a\\\"")))) (div (@ (id "doc-b-" "number-container-length") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "number-container-length") " " (span (@ (class "first-sig")) "a base ->")) (div (@ (class "rest-sig")) (div "integer:positive-integer integer -> integer")) (div (@ (class "description")) (("results in the number of vector elements of size base required to store the individual digits of the given positive number in the given base." (br) "example use case is calculating the size of a bytevector for storing an integer")))) (div (@ (id "doc-b-" "number-format-float") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "number-format-float") " " (span (@ (class "first-sig")) "a #:decimal-min #:decimal-max #:truncate* #:base ->")) "" (div (@ (class "description")) (("number")))) (div (@ (id "doc-b-" "round-to-decimal-places") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "round-to-decimal-places") " " (span (@ (class "first-sig")) "a decimal-places ->")) (div (@ (class "rest-sig")) (div "number number -> number")) "") (div (@ (id "doc-b-" "round-to-increment") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "round-to-increment") " " (span (@ (class "first-sig")) "a increment ->")) (div (@ (class "rest-sig")) (div "number number -> number")) (div (@ (class "description")) (("round a number to the the nearest multiple of \\\"increment\\\" (using \\\"round\\\")." (br) "if the number is exactly half-way in between increments, take the lower increment multiple." (br) "example: (1.1 3) -> 0, (1.6 3) -> 3, (1.5 3) -> 0")))) (div (@ (id "doc-b-" "truncate-to-decimal-places") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "truncate-to-decimal-places") " " (span (@ (class "first-sig")) "a decimal-places ->")) (div (@ (class "rest-sig")) (div "number number -> number")) "")))))))) ()))