Skip to content

BigRational

Overview

Contains an import-style snippet of shader code, with dependencies on other snippets.

@author Jonathan Olson <jonathan.olson@colorado.edu>

Class BigRational

import { BigRational } from 'scenerystack/alpenglow';

Constructor

new BigRational( numerator : bigint | number, denominator : bigint | number )

Instance Methods

copy() : BigRational

plus( rational : BigRational ) : BigRational

lazy implementation NOT meant to be in JS due to excess reduction

minus( rational : BigRational ) : BigRational

lazy implementation NOT meant to be in JS due to excess reduction

times( rational : BigRational ) : BigRational

lazy implementation NOT meant to be in JS due to excess reduction

dividedBy( rational : BigRational ) : BigRational

lazy implementation NOT meant to be in JS due to excess reduction

reduce()

reduced() : BigRational

isZero() : boolean

isNegative() : boolean

isPositive() : boolean

ratioTest() : number

equalsCrossMul( other : BigRational ) : boolean

compareCrossMul( other : BigRational ) : number

equals( other : BigRational ) : boolean

NOT for WGSL, slow

toFloat( precision ) : number

TODO: better way to do this?

toString() : string

Instance Properties

numerator : bigint

denominator : bigint

Static Methods

whole( numerator : number | bigint ) : BigRational

inverse( numerator : number | bigint ) : BigRational

gcdBigInt( a : bigint, b : bigint ) : bigint

Static Properties

ZERO : BigRational

(readonly)

ONE : BigRational

(readonly)

Source Code

See the source for BigRational.ts in the alpenglow repository.