Crate deterministic_trigonometry

Source
Expand description

Deterministic trigonometry across architectures without using floating point arithmetic.

  • Uses (i32, i32) tuples to represent fractions.
  • Uses pre-baked arrays for trigonometry results.
  • Deterministic across compilers and computer architectures.
  • Introduces imprecision due to rounding errors.
  • Most likely to be useful for games that depend on lockstep determinism.

§Example

use deterministic_trigonometry::DTrig;

fn main (){

let d_trig = DTrig::initialize();

let sine_of_pi_over_three = d_trig.sine((1047,1000));

println!("The sine of 1047/1000 radians is {}/{}.", sine_of_pi_over_three.0, sine_of_pi_over_three.1);

}

Modules§

initialize
This module contains the code that sets the values for the arrays from the pre-baked tables.

Structs§

DTrig
Main struct through which trig functions are implemented.