#dsp #float #floating-point #off #numbers #control #denormals

no_denormals

Temporarily turn off floating point denormals

3 releases

0.1.2 Jul 14, 2023
0.1.1 Jun 11, 2023
0.1.0 Jun 11, 2023

#422 in Audio

Download history 46/week @ 2024-01-11 27/week @ 2024-01-18 17/week @ 2024-01-25 34/week @ 2024-02-01 36/week @ 2024-02-08 138/week @ 2024-02-15 106/week @ 2024-02-22 82/week @ 2024-02-29 77/week @ 2024-03-07 71/week @ 2024-03-14 69/week @ 2024-03-21 151/week @ 2024-03-28 314/week @ 2024-04-04 354/week @ 2024-04-11 318/week @ 2024-04-18 265/week @ 2024-04-25

1,293 downloads per month
Used in 3 crates (via web-audio-api)

MIT license

7KB
109 lines

no_denormals

build Crates.io MIT licensed

Temporarily turn off floating point denormals.

Internally, this uses a RAII-style guard to manage the state of certain processor flags. On x86 and x86_64, this sets the flush-to-zero and denormals-are-zero flags in the MXCSR register. On aarch64 this sets the flush-to-zero flag in the FPCR register. In all cases, the register will be reset to its initial state when the guard is dropped.

Usage

use no_denormals::no_denormals;

no_denormals(|| {
	// your DSP code here.
});


lib.rs:

Temporarily turn off floating point denormals.

Internally, this uses a RAII-style guard to manage the state of certain processor flags. On x86 and x86_64, this sets the flush-to-zero and denormals-are-zero flags in the MXCSR register. On aarch64 this sets the flush-to-zero flag in the FPCR register. In all cases, the register will be reset to its initial state when the guard is dropped.

Usage

use no_denormals::no_denormals;

no_denormals(|| {
	// your DSP code here.
});

No runtime deps