#atomic #float #floating-point #atomicf32

no-std atomic_float

Floating point types which can be safely shared between threads

3 releases (stable)

1.1.0 Aug 31, 2024
1.0.0 May 4, 2024
0.1.0 Sep 14, 2020

#30 in Concurrency

Download history 13593/week @ 2024-07-20 13295/week @ 2024-07-27 9890/week @ 2024-08-03 13392/week @ 2024-08-10 13461/week @ 2024-08-17 13714/week @ 2024-08-24 13351/week @ 2024-08-31 14569/week @ 2024-09-07 14971/week @ 2024-09-14 18503/week @ 2024-09-21 17022/week @ 2024-09-28 21625/week @ 2024-10-05 26960/week @ 2024-10-12 27379/week @ 2024-10-19 27527/week @ 2024-10-26 24768/week @ 2024-11-02

110,777 downloads per month
Used in 344 crates (31 directly)

Apache-2.0 OR MIT OR Unlicense

67KB
386 lines

atomic_float

Build Status codecov Docs Latest Version

This crate provides AtomicF32 and AtomicF64 types that behave almost identically to the integer atomics in the stdlib.

Usage

use atomic_float::AtomicF32;
use core::sync::atomic::Ordering::Relaxed;

static A_STATIC: AtomicF32 = AtomicF32::new(800.0);

// Should support the full std::sync::atomic::AtomicFoo API
A_STATIC.fetch_add(30.0, Relaxed);
A_STATIC.fetch_sub(-55.0, Relaxed);
// But also supports things that can be implemented
// efficiently easily, like sign-bit operations.
A_STATIC.fetch_neg(Relaxed);

assert_eq!(A_STATIC.load(Relaxed), -885.0);

License

Licensed under either of

at your option.

Dependencies

~165KB