about summary refs log tree commit diff
path: root/compiler/rustc_interface/src/errors.rs
diff options
context:
space:
mode:
author许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2024-06-09 19:16:19 +0100
committerGitHub <noreply@github.com>2024-06-09 19:16:19 +0100
commit61671a7e346bbd9297e4235c05ddfaa34bf37c48 (patch)
treecb658bec0ef6023e37fe2d545a315f83c78d81a1 /compiler/rustc_interface/src/errors.rs
parentf000b428bd0cb642422f2fea815a33cda971b1fe (diff)
parent54bb08d53881da7c43b91fd5a6bd8ef9a3b754e6 (diff)
downloadrust-61671a7e346bbd9297e4235c05ddfaa34bf37c48.tar.gz
rust-61671a7e346bbd9297e4235c05ddfaa34bf37c48.zip
Rollup merge of #125253 - sunsided:feature/FRAC_1_SQRT_PI, r=Mark-Simulacrum
Add `FRAC_1_SQRT_2PI` constant to f16/f32/f64/f128

This adds the `FRAC_1_SQRT_2PI` to the `f16`, `f32`, `f64` and `f128` as [`1/√(2π)`](https://www.wolframalpha.com/input?i=1%2Fsqrt%282*pi%29). The rationale is that while `FRAC_1_SQRT_PI` already exists, [Gaussian calculations](https://en.wikipedia.org/wiki/Gaussian_function) for random normal distributions require a `1/(σ√(2π))` term, which could then be directly expressed e.g. as `f32::FRAC_1_SQRT_2PI / sigma`.

The actual value is approximately `1/√(2π) = 0.3989422804014326779399460599343818684758586311649346576659258296…`. Truncated/rounded forms were used for the individual types.

---

~~I did not any of the `#[unstable]` attributes since I am not aware of their implications.~~

**Edit:** I applied the stability attributes from the surrounding types according to what seemed most likely correct. I believe the `more_float_constants` feature marker is incorrectly applied, but I wasn't sure how to proceed.
Diffstat (limited to 'compiler/rustc_interface/src/errors.rs')
0 files changed, 0 insertions, 0 deletions