{"size": 1459, "ext": "scrbl", "max_stars_repo_path": "scribblings/bitwise-exact-rational.scrbl", "max_stars_repo_name": "AlexKnauth/bitwise-exact-rational", "max_stars_repo_stars_event_min_datetime": "2021-06-21T20:24:01.000Z", "max_stars_repo_stars_event_max_datetime": "2021-10-17T14:37:28.000Z", "max_issues_repo_path": "scribblings/bitwise-exact-rational.scrbl", "max_issues_repo_name": "AlexKnauth/bitwise-exact-rational", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "scribblings/bitwise-exact-rational.scrbl", "max_forks_repo_name": "AlexKnauth/bitwise-exact-rational", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 4, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 24.3166666667, "max_line_length": 84, "alphanum_fraction": 0.6874571624}
#lang scribble/manual

@(require racket/require
          scribble/example
          (for-label bitwise-exact-rational
                     (subtract-in typed/racket/base bitwise-exact-rational)))

@title{bitwise-exact-rational}
@author{Alex Knauth}

@defmodule[bitwise-exact-rational]

@(define ev (make-base-eval #:lang 'typed/racket '(require bitwise-exact-rational)))

Bitwise operations treating exact-rational numbers as bit fields.

@defproc[(bitwise-ior [x Exact-Rational] [y Exact-Rational]) Exact-Rational]{
Produces the bitwise "inclusive or" of @racket[x] and
@racket[y] in their fully infinite two's complement
representation.

@examples[
  #:eval ev
  (bitwise-ior 1 2)
  (bitwise-ior -32 1)
  (bitwise-ior 9 (+ 5 1/4))
  (bitwise-ior 64/127 1024/2047)
]
}

@defproc[(bitwise-and [x Exact-Rational] ...) Exact-Rational]{
Produces the bitwise "and" of the @racket[x]s in their fully
infinite two's complement representation.

@examples[
  #:eval ev
  (bitwise-and)
  (bitwise-and 1 2)
  (bitwise-and -32 1)
  (bitwise-and (+ 9 3/4) (+ 5 1/4))
  (bitwise-and 64/127 1024/2047)
]
}

@defproc[(bitwise-xor [x Exact-Rational] ...) Exact-Rational]{
Produces the bitwise "exclusive or" of the @racket[x]s in
their fully infinite two's complement representation.

@examples[
  #:eval ev
  (bitwise-xor)
  (bitwise-xor 1 2)
  (bitwise-xor 1 5)
  (bitwise-xor -32 1)
  (bitwise-xor -32 -1)
  (bitwise-xor 9 (+ 5 1/4))
  (bitwise-xor 64/127 1024/2047)
]
}
