ryu_floating_decimal

Crates.ioryu_floating_decimal
lib.rsryu_floating_decimal
version0.1.0
sourcesrc
created_at2020-06-01 18:35:38.691439
updated_at2020-06-01 18:35:38.691439
descriptionFast floating point to floating decimal conversion. See the crate 'ryu' for more details
homepage
repositoryhttps://github.com/torrencem/ryu-floating-decimal
max_upload_size
id248772
size85,216
Matt Torrence (Torrencem)

documentation

https://docs.rs/ryu-floating-decimal

README

Ryu Floating Decimal

This crate directly copies the internals of the ryu rust crate, exposing some useful functions and types for more flexible float printing.

This crate exposes the functions d2d and f2d, which convert from f64 to FloatingDecimal64 and f32 to FloatingDecimal32 respectively. These floating decimals can be converted to strings in a custom way.

See the original crate for benchmarks and other information.

Example

use ryu_floating_decimal::f2d;
let value: f32 = 12.091;
let decimal = f2d(value);
assert_eq!(decimal.mantissa, 12091);
assert_eq!(decimal.exponent, -3);

License

Licensed under Apache License, Version 2.0, copied from the original crate

Commit count: 3

cargo fmt