#printf #floating-point #libc #output #format #f32 #f64

gpoint

Wrapper for using libc’s printf("%g") format for your floating point output

7 releases

0.2.1 Aug 31, 2021
0.2.0 Aug 27, 2021
0.1.4 Aug 27, 2021
0.1.3 Jul 12, 2021

#158 in Value formatting

Download history 5580/week @ 2024-10-08 4970/week @ 2024-10-15 4591/week @ 2024-10-22 5000/week @ 2024-10-29 5507/week @ 2024-11-05 5616/week @ 2024-11-12 5728/week @ 2024-11-19 5625/week @ 2024-11-26 6185/week @ 2024-12-03 5727/week @ 2024-12-10 5955/week @ 2024-12-17 6047/week @ 2024-12-24 5462/week @ 2024-12-31 5554/week @ 2025-01-07 5576/week @ 2025-01-14 4119/week @ 2025-01-21

21,557 downloads per month
Used in scx_lavd

MIT/Apache

8KB
166 lines

"G" Format for Floating Point

Prints floating-point exactly like a printf("%g", value), using a Display implementation via libc's printf()'s .

Usage

Use the crates.io repository; add this to your Cargo.toml along with the rest of your dependencies:

[dependencies]
gpoint = "0.2"

Then wrap your f32 or f64 with a GPoint:

use gpoint::GPoint;

println!("answer: {}", GPoint(42.));

See the API documentation for further details.


lib.rs:

Wrapper for using libc's printf("%g") format for your floating point output

Dependencies

~43KB