{"id":22375869,"url":"https://github.com/stylewarning/computable-reals","last_synced_at":"2026-01-30T20:31:12.192Z","repository":{"id":140286321,"uuid":"124187131","full_name":"stylewarning/computable-reals","owner":"stylewarning","description":"Arbitrary precision, automatic re-computing real numbers in Common Lisp.","archived":false,"fork":false,"pushed_at":"2024-01-23T18:39:03.000Z","size":32,"stargazers_count":33,"open_issues_count":8,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-27T08:59:09.214Z","etag":null,"topics":["arbitrary-precision","common-lisp","lisp","math","numerical-analysis"],"latest_commit_sha":null,"homepage":"","language":"Common Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stylewarning.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-03-07T06:02:28.000Z","updated_at":"2025-05-23T16:54:23.000Z","dependencies_parsed_at":"2025-06-14T22:49:10.753Z","dependency_job_id":null,"html_url":"https://github.com/stylewarning/computable-reals","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/stylewarning/computable-reals","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stylewarning%2Fcomputable-reals","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stylewarning%2Fcomputable-reals/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stylewarning%2Fcomputable-reals/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stylewarning%2Fcomputable-reals/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stylewarning","download_url":"https://codeload.github.com/stylewarning/computable-reals/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stylewarning%2Fcomputable-reals/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28918436,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-30T20:25:28.696Z","status":"ssl_error","status_checked_at":"2026-01-30T20:25:13.426Z","response_time":66,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arbitrary-precision","common-lisp","lisp","math","numerical-analysis"],"created_at":"2024-12-04T21:28:02.959Z","updated_at":"2026-01-30T20:31:12.186Z","avatar_url":"https://github.com/stylewarning.png","language":"Common Lisp","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Computable Reals\n\n## Introduction\n\nComputable real numbers `x` are interpreted as (potentially) infinite\nfractions in base 2 that are specified through a rule for computation\nof an integer `a` with `|(2^k)*x - a| \u003c= 1` for any `k\u003e=0`.\n\nThe internal data structure should not be accessed.\n\nThe interface for the outside world is as follows:\n\nThe type `CREAL` is a supertype of the type `RATIONAL`. `(CREAL-P x)`, for\nan object `x`, returns `T` if `x` is of type `CREAL`, otherwise `NIL`.\n\n`(RATIONAL-APPROX-R x k)`, for a `CREAL` `x` and an integer `k\u003e=0`, returns a rational `a` with `|x - a| \u003c 1/2^k`.\n\n`(MAKE-REAL fun)` returns the real number given by `fun`. Here `fun` is a\nfunction taking an argument `k`, that computes `a` as above.\n\n`CREAL`s are displayed by `PRINT` (etc.) as a decimal fraction. The\nerror hereby is at most one unit in the last digit that was\noutput. The number of decimal digits after the decimal point is\ndefined through the dynamic variable `*PRINT-PREC*`.\n\nFor *internal* comparison operations etc. a precision threshold is used. It is\ndefined through the dynamic variable `*CREAL-TOLERANCE*`. Its value should\nbe a nonnegative integer `n`, meaning that numbers are considered equal\nif they differ by at most `2^(-n)`.\n\n**N.B.** There are *no* external comparison functions, since\ncomparison is in general not decidable in finite time. Instead, we\nrecommend using ordinary Common Lisp comparison functions after\nproducing a `k`-bit approximation using the `RATIONAL-APPROX-R` to\nconvert a `CREAL` to a rational number.\n\n## Exported Functions and Constants\n\nThe following functions, constants and variables are exported. (The\npackage is named `\"COMPUTABLE-REALS\"` or `\"CR\"` for short.)\n\n```\nCREAL                  type        type of the computable real numbers\nCREAL-P object         function    tests for type CREAL\n*PRINT-PREC*           variable    specifies precision of output\n*CREAL-TOLERANCE*      variable    precision threshold for comparison\nAPPROX-R x:creal k:int\u003e=0\n                       function    returns approximation of x to k digits\nMAKE-REAL function     function    creates object of type CREAL\nRATIONAL-APPROX-R x:creal k:int\u003e0\n                       function    returns a rational approximation that\n                                    differs by less than 2^(-k).\nRATIONALIZE-R x:creal k:int\u003e0\n                       function    returns the simplest rational approximation\n                                    that differs by less than 2^(-k)\nRAW-APPROX-R x:creal   function    returns 3 values a,n,s with:\n                                   if a = 0: |x| \u003c= 2^(-n), s = 0\n                                       and n \u003e= *CREAL-TOLERANCE*\n                                   else: a0 integer \u003e 4, n0 integer \u003e=0,\n                                       s = +1 or -1, and sign(x) = s,\n                                       (a-1)*2^(-n) \u003c= |x| \u003c= (a+1)*2^(-n)\nPRINT-R x:creal k:int\u003e=0 \u0026optional (flag t)\n                       function    outputs x with k decimal digits.\n                                   If flag is true, first a newline.\n+R {creal}*            function    computes the sum of the arguments\n-R creal {creal}*      function    computes negative or difference\n*R {creal}*            function    computes the product of the arguments\n/R creal {creal}*      function    computes reciprocal or quotient\nSQRT-R creal           function    computes the square root\n+LOG2-R+               constant    log(2)\n+PI-R+                 constant    pi\n+2PI-R+                constant    2*pi\n+PI/2-R+               constant    pi/2\n+PI/4-R+               constant    pi/4\nLOG-R x:creal \u0026optional b:creal\n                       function    computes the logarithm of n in base b;\n                                   default is the natural logarithm\nEXP-R creal            function    computes the exponential function\nEXPT-R x:creal y:creal function    computes x^y\nSIN-R creal            function    computes the sine\nCOS-R creal            function    computes the cosine\nTAN-R creal            function    computes the tangent\nATAN-R x:creal \u0026optional y:creal\n                       function    computes the arctangent of x or\n                                   the phase angle of (x,y)\nASH-R x:creal n:int    function    computes x * 2^n\nROUND-R x:creal \u0026optional y:creal\n                       function    computes two values q (integer) and r\n                                   (creal) with x = q*y + r and |r|\u003c=|y|/2\n                                   according to the precision specified by\n                                   *CREAL-TOLERANCE*\nFLOOR-R x:creal \u0026optional y:creal\n                       function    like ROUND-R, corresponding to floor\nCEILING-R x:creal \u0026optional y:creal\n                       function    like ROUND-R, corresponding to ceiling\nTRUNCATE-R x:creal \u0026optional y:creal\n                       function    like ROUND-R, corresponding to truncate\n```\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstylewarning%2Fcomputable-reals","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstylewarning%2Fcomputable-reals","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstylewarning%2Fcomputable-reals/lists"}