Skip to content
This repository has been archived by the owner on Jan 13, 2023. It is now read-only.

mongodb-rust/decimal128

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

decimal 128

128-bit wide floating point implementation for Rust

Installation

cargo add decimal128

Usage

This crate is a work-in-progress and does not have all applicable methods implemented as per IEEE Standard for Floating-Point Arithmetic and MongoDB Decimal128 BSON type. The following methods are currently implemented:

  • Decimal128.from_raw_bytes
  • Decimal128.zero
  • Decimal128.is_nan
  • Decimal128.is_negative
  • Decimal128.is_zero
  • Decimal128.to_string
use decimal128;

let vec: [u8; 16] = [
    0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00,
];
let dec128 = Decimal128::from_raw_buf(vec);
let string = dec128.to_string();
assert_eq!("-Infinity".to_string(), string);

License

Licensed under the Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0) at your option.

About

WASM-compatible Decimal128 implementation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages