computable-real 0.3.0

Computable real number
Documentation
  • Coverage
  • 71.43%
    5 out of 7 items documented2 out of 2 items with examples
  • Size
  • Source code size: 53.67 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 3.31 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 20s Average build duration of successful builds.
  • all releases: 18s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • hkalexling

This crate provides an API to work with computable real numbers (or recursive real numbers). We represent real numbers as a function that accepts a desired precision level and returns an approximation of the real number. By providing an increasingly smaller precision level, we can approximate the real number to an arbitrary precision.

The idea is from the paper Towards an API for the Real Numbers by H. Boehm, and the overall design and a lot of the functions are from the CR.java and UnaryCRFunction.java files in the Android ART repository.

Example

use computable_real::Real;

let pi = Real::pi();
println!("π = {}", pi.render(10));
assert_eq!(pi.render(10), "3.1415926536");
let sin_pi = pi.clone().sin();
println!("sin(π) = {}", sin_pi.render(10));
assert_eq!(sin_pi.render(10), "0.0000000000");

// We can evaluate and render pi past the limit of f64
println!("π = {}", pi.render(30));
assert_eq!(pi.render(30), "3.141592653589793238462643383280");