#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 10271/week @ 2024-08-02 12581/week @ 2024-08-09 12977/week @ 2024-08-16 14046/week @ 2024-08-23 12811/week @ 2024-08-30 14843/week @ 2024-09-06 15052/week @ 2024-09-13 17685/week @ 2024-09-20 17814/week @ 2024-09-27 20281/week @ 2024-10-04 25666/week @ 2024-10-11 28646/week @ 2024-10-18 27048/week @ 2024-10-25 25526/week @ 2024-11-01 23716/week @ 2024-11-08 25085/week @ 2024-11-15

106,185 downloads per month
Used in 347 crates (32 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

~160KB