#atomic #float #floating-point #atomicf32

no-std atomic_float

Floating point types which can be safely shared between threads

1 unstable release

0.1.0 Sep 14, 2020

#182 in Concurrency

Download history 12143/week @ 2023-11-23 14517/week @ 2023-11-30 12293/week @ 2023-12-07 11270/week @ 2023-12-14 9554/week @ 2023-12-21 7543/week @ 2023-12-28 13701/week @ 2024-01-04 16210/week @ 2024-01-11 19166/week @ 2024-01-18 18531/week @ 2024-01-25 15547/week @ 2024-02-01 17663/week @ 2024-02-08 14865/week @ 2024-02-15 15845/week @ 2024-02-22 13984/week @ 2024-02-29 8943/week @ 2024-03-07

56,944 downloads per month
Used in 298 crates (14 directly)

Apache-2.0 OR MIT OR Zlib

63KB
340 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.

No runtime deps

Features