Added wasm binding to KalkNum.estimate()

This commit is contained in:
bakk 2021-05-18 20:40:43 +02:00
parent 93830090b5
commit cc776367fa

View File

@ -43,6 +43,12 @@ lazy_static! {
}
impl KalkNum {
#[cfg(not(feature = "rug"))]
#[wasm_bindgen(js_name = estimate)]
pub fn estimate_js(&self) -> Option<String> {
self.estimate()
}
// Get an estimate of what the number is, eg. 3.141592 => π
pub fn estimate(&self) -> Option<String> {
let fract = self.value.clone().fract().abs();