#atomic #float #atomicf32 #atomicf32

no-std atomic_float

Floating point types which can be safely shared between threads

1 unstable release

0.1.0 Sep 14, 2020

#248 in Concurrency

Download history 7488/week @ 2022-08-15 3722/week @ 2022-08-22 5895/week @ 2022-08-29 5649/week @ 2022-09-05 8405/week @ 2022-09-12 7647/week @ 2022-09-19 7471/week @ 2022-09-26 7164/week @ 2022-10-03 6936/week @ 2022-10-10 5406/week @ 2022-10-17 8011/week @ 2022-10-24 6560/week @ 2022-10-31 6250/week @ 2022-11-07 5943/week @ 2022-11-14 5337/week @ 2022-11-21 6081/week @ 2022-11-28

24,037 downloads per month
Used in 83 crates (3 directly)

Apache-2.0 OR MIT OR Zlib

62KB
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

  • atomic_f64