1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
* SPDX-License-Identifier: MIT
* Copyright (c) 2023 - 2026. The DeepCausality Authors and Contributors. All Rights Reserved.
*/
pub
pub
pub
pub
pub
/// Common physical constants used throughout the library.
///
/// Values are taken from the [CODATA 2022](https://physics.nist.gov/cuu/Constants/) recommended values.
///
/// Note:
/// * "Exact" values are defined by international agreement (SI definition).
/// * Other values are experimental measurements with associated uncertainties (ignored here for standard f64 precision).
pub
pub
pub
pub
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
use RealField;
use FromPrimitive;
/// Casts an `f64` physical constant to a target real-field precision `R`.
///
/// Physical constants are defined in `f64` (the precision at which the vast
/// majority of CODATA and experimental values are published). Generic,
/// real-field kernels need those same constants at their own precision `R`
/// (e.g. `f32` or `f64`). This helper is the single primitive that performs
/// that conversion, and the typed constant accessors (for example
/// [`graphene_lattice_const`] and [`reduced_planck_constant`]) are thin
/// wrappers over it.
///
/// # Panics
/// Panics only if `R::from_f64` returns `None`, which is impossible for the
/// standard real fields (`f32`, `f64`): every finite, in-range `f64` constant
/// converts. The panic therefore signals a logic error in a custom `R`
/// implementation, not a runtime failure mode.