Skip to content

About

C implementation of Boehm's "Towards an API for the Real Numbers"

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

77 Commits

Folders and files

Repository files navigation

UnifiedReals

UnifiedReals is a C port of Hans-J. Boehm's "UnifiedReal" API from the Android calculator implementation. It combines bounded rationals with constructive reals (CR) and symbolic properties to make many exact comparisons and formatting decisions decidable in "easy" cases while still supporting arbitrary-precision evaluation.

Key components:

  • src/cr.c: constructive reals (recursive reals) with guaranteed error bounds.
  • src/bounded_rational.c: bounded rationals with a 10,000-bit budget.
  • src/unified_real.c: UnifiedReal layer with properties for comparability.
  • src/ur_calc.c: CLI calculator for interactive evaluation.

Reference implementation and paper:

  • Java reference: ureal_test/com/android/calculator2/evaluation/UnifiedReal.java
  • Paper: 2020-boehm.txt / 2020-boehm.pdf

Build

Build all targets:

make

Build specific tools:

make build/ur_calc
make build/unified_real_test

Run Tests

Core unit tests:

make build/unified_real_test
build/unified_real_test

Full test suite (includes longer-running tests):

make test

CLI Calculator

Examples:

build/ur_calc "1/10 + 0.2"
build/ur_calc "e^(PI*sqrt(163)) - 262_537_412_640_769" -200

Notes:

  • Integer literals are exact.
  • Double literals are parsed exactly to their IEEE-754 value.
  • Underscores in numeric literals are accepted for readability.

About

C implementation of Boehm's "Towards an API for the Real Numbers"

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages