Debian Codegraph @

debian/missing-sources/glam-0.29.3/src/f64/math.rs

raw symbols SCIP
1 #[cfg(any(feature = "libm", all(feature = "nostd-libm", not(feature = "std"))))]
2 mod libm_math {
3 #[inline(always)]
4 pub(craterust-analyzer cargo glam 0.29.3 crate/) fn abs(f: f64) -> f64 {
5 libm::fabs(f)
6 }
7
8 #[inline(always)]
9 pub(craterust-analyzer cargo glam 0.29.3 crate/) fn acos_approx(f: f64) -> f64 {
10 libm::acos(f.clamp(-1.0, 1.0))
11 }
12
13 #[inline(always)]
14 pub(craterust-analyzer cargo glam 0.29.3 crate/) fn atan2(f: f64, other: f64) -> f64 {
15 libm::atan2(f, other)
16 }
17
18 #[inline(always)]
19 pub(craterust-analyzer cargo glam 0.29.3 crate/) fn sin(f: f64) -> f64 {
20 libm::sin(f)
21 }
22
23 #[inline(always)]
24 pub(craterust-analyzer cargo glam 0.29.3 crate/) fn sin_cos(f: f64) -> (f64, f64) {
25 libm::sincos(f)
26 }
27
28 #[inline(always)]
29 pub(craterust-analyzer cargo glam 0.29.3 crate/) fn tan(f: f64) -> f64 {
30 libm::tan(f)
31 }
32
33 #[inline(always)]
34 pub(craterust-analyzer cargo glam 0.29.3 crate/) fn sqrt(f: f64) -> f64 {
35 libm::sqrt(f)
36 }
37
38 #[inline(always)]
39 pub(craterust-analyzer cargo glam 0.29.3 crate/) fn copysign(f: f64, sign: f64) -> f64 {
40 libm::copysign(f, sign)
41 }
42
43 #[inline(always)]
44 pub(craterust-analyzer cargo glam 0.29.3 crate/) fn signum(f: f64) -> f64 {
45 if f.is_nan() {
46 f64::NAN
47 } else {
48 copysignrust-analyzer cargo glam 0.29.3 f64/math/std_math/copysign().(1.0, f)
49 }
50 }
51
52 #[inline(always)]
53 pub(craterust-analyzer cargo glam 0.29.3 crate/) fn round(f: f64) -> f64 {
54 libm::round(f)
55 }
56
57 #[inline(always)]
58 pub(craterust-analyzer cargo glam 0.29.3 crate/) fn trunc(f: f64) -> f64 {
59 libm::trunc(f)
60 }
61
62 #[inline(always)]
63 pub(craterust-analyzer cargo glam 0.29.3 crate/) fn ceil(f: f64) -> f64 {
64 libm::ceil(f)
65 }
66
67 #[inline(always)]
68 pub(craterust-analyzer cargo glam 0.29.3 crate/) fn floor(f: f64) -> f64 {
69 libm::floor(f)
70 }
71
72 #[inline(always)]
73 pub(craterust-analyzer cargo glam 0.29.3 crate/) fn exp(f: f64) -> f64 {
74 libm::exp(f)
75 }
76
77 #[inline(always)]
78 pub(craterust-analyzer cargo glam 0.29.3 crate/) fn powf(f: f64, n: f64) -> f64 {
79 libm::pow(f, n)
80 }
81
82 #[inline(always)]
83 pub(craterust-analyzer cargo glam 0.29.3 crate/) fn mul_add(a: f64, b: f64, c: f64) -> f64 {
84 libm::fma(a, b, c)
85 }
86
87 #[inline]
88 pub fn div_euclid(a: f64, b: f64) -> f64 {
89 // Based on https://doc.rust-lang.org/src/std/f64.rs.html#293
90 let q = libm::trunc(a / b);
91 if a % b < 0.0 {
92 return if b > 0.0 { q - 1.0 } else { q + 1.0 };
93 }
94 q
95 }
96
97 #[inline]
98 pub fn rem_euclid(a: f64, b: f64) -> f64 {
99 let r = a % b;
100 if r < 0.0 {
101 r + absrust-analyzer cargo glam 0.29.3 f64/math/std_math/abs().(b)
102 } else {
103 r
104 }
105 }
106 }
107
108 #[cfg(all(not(feature = "libm"), feature = "std"))]
109 mod std_mathrust-analyzer cargo glam 0.29.3 f64/math/std_math/ {
110 #[inline(always)]
111 pub(craterust-analyzer cargo glam 0.29.3 crate/) fn absrust-analyzer cargo glam 0.29.3 f64/math/std_math/abs().(f: f64) -> f64 {
112 f64::absrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f64/impl#[f64]abs().(f)
113 }
114
115 #[inline(always)]
116 pub(craterust-analyzer cargo glam 0.29.3 crate/) fn acos_approxrust-analyzer cargo glam 0.29.3 f64/math/std_math/acos_approx().(f: f64) -> f64 {
117 f64::acosrust-analyzer cargo std https://github.com/rust-lang/rust/library/std f64/impl#[f64]acos().(f64::clamprust-analyzer cargo core https://github.com/rust-lang/rust/library/core f64/impl#[f64]clamp().(f, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][Neg]neg().1.0, 1.0))
118 }
119
120 #[inline(always)]
121 pub(craterust-analyzer cargo glam 0.29.3 crate/) fn atan2rust-analyzer cargo glam 0.29.3 f64/math/std_math/atan2().(f: f64, other: f64) -> f64 {
122 f64::atan2rust-analyzer cargo std https://github.com/rust-lang/rust/library/std f64/impl#[f64]atan2().(f, other)
123 }
124
125 #[inline(always)]
126 pub(craterust-analyzer cargo glam 0.29.3 crate/) fn sinrust-analyzer cargo glam 0.29.3 f64/math/std_math/sin().(f: f64) -> f64 {
127 f64::sinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std f64/impl#[f64]sin().(f)
128 }
129
130 #[inline(always)]
131 pub(craterust-analyzer cargo glam 0.29.3 crate/) fn sin_cosrust-analyzer cargo glam 0.29.3 f64/math/std_math/sin_cos().(f: f64) -> (f64, f64) {
132 f64::sin_cosrust-analyzer cargo std https://github.com/rust-lang/rust/library/std f64/impl#[f64]sin_cos().(f)
133 }
134
135 #[inline(always)]
136 pub(craterust-analyzer cargo glam 0.29.3 crate/) fn tanrust-analyzer cargo glam 0.29.3 f64/math/std_math/tan().(f: f64) -> f64 {
137 f64::tanrust-analyzer cargo std https://github.com/rust-lang/rust/library/std f64/impl#[f64]tan().(f)
138 }
139
140 #[inline(always)]
141 pub(craterust-analyzer cargo glam 0.29.3 crate/) fn sqrtrust-analyzer cargo glam 0.29.3 f64/math/std_math/sqrt().(f: f64) -> f64 {
142 f64::sqrtrust-analyzer cargo std https://github.com/rust-lang/rust/library/std f64/impl#[f64]sqrt().(f)
143 }
144
145 #[inline(always)]
146 pub(craterust-analyzer cargo glam 0.29.3 crate/) fn copysignrust-analyzer cargo glam 0.29.3 f64/math/std_math/copysign().(f: f64, sign: f64) -> f64 {
147 f64::copysignrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f64/impl#[f64]copysign().(f, sign)
148 }
149
150 #[inline(always)]
151 pub(craterust-analyzer cargo glam 0.29.3 crate/) fn signumrust-analyzer cargo glam 0.29.3 f64/math/std_math/signum().(f: f64) -> f64 {
152 f64::signumrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f64/impl#[f64]signum().(f)
153 }
154
155 #[inline(always)]
156 pub(craterust-analyzer cargo glam 0.29.3 crate/) fn roundrust-analyzer cargo glam 0.29.3 f64/math/std_math/round().(f: f64) -> f64 {
157 f64::roundrust-analyzer cargo std https://github.com/rust-lang/rust/library/std f64/impl#[f64]round().(f)
158 }
159
160 #[inline(always)]
161 pub(craterust-analyzer cargo glam 0.29.3 crate/) fn truncrust-analyzer cargo glam 0.29.3 f64/math/std_math/trunc().(f: f64) -> f64 {
162 f64::truncrust-analyzer cargo std https://github.com/rust-lang/rust/library/std f64/impl#[f64]trunc().(f)
163 }
164
165 #[inline(always)]
166 pub(craterust-analyzer cargo glam 0.29.3 crate/) fn ceilrust-analyzer cargo glam 0.29.3 f64/math/std_math/ceil().(f: f64) -> f64 {
167 f64::ceilrust-analyzer cargo std https://github.com/rust-lang/rust/library/std f64/impl#[f64]ceil().(f)
168 }
169
170 #[inline(always)]
171 pub(craterust-analyzer cargo glam 0.29.3 crate/) fn floorrust-analyzer cargo glam 0.29.3 f64/math/std_math/floor().(f: f64) -> f64 {
172 f64::floorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std f64/impl#[f64]floor().(f)
173 }
174
175 #[inline(always)]
176 pub(craterust-analyzer cargo glam 0.29.3 crate/) fn exprust-analyzer cargo glam 0.29.3 f64/math/std_math/exp().(f: f64) -> f64 {
177 f64::exprust-analyzer cargo std https://github.com/rust-lang/rust/library/std f64/impl#[f64]exp().(f)
178 }
179
180 #[inline(always)]
181 pub(craterust-analyzer cargo glam 0.29.3 crate/) fn powfrust-analyzer cargo glam 0.29.3 f64/math/std_math/powf().(f: f64, n: f64) -> f64 {
182 f64::powfrust-analyzer cargo std https://github.com/rust-lang/rust/library/std f64/impl#[f64]powf().(f, n)
183 }
184
185 #[inline(always)]
186 pub(craterust-analyzer cargo glam 0.29.3 crate/) fn mul_addrust-analyzer cargo glam 0.29.3 f64/math/std_math/mul_add().(a: f64, b: f64, c: f64) -> f64 {
187 f64::mul_addrust-analyzer cargo std https://github.com/rust-lang/rust/library/std f64/impl#[f64]mul_add().(a, b, c)
188 }
189
190 #[inline]
191 pub fn div_euclidrust-analyzer cargo glam 0.29.3 f64/math/std_math/div_euclid().(a: f64, b: f64) -> f64 {
192 f64::div_euclidrust-analyzer cargo std https://github.com/rust-lang/rust/library/std f64/impl#[f64]div_euclid().(a, b)
193 }
194
195 #[inline]
196 pub fn rem_euclidrust-analyzer cargo glam 0.29.3 f64/math/std_math/rem_euclid().(a: f64, b: f64) -> f64 {
197 f64::rem_euclidrust-analyzer cargo std https://github.com/rust-lang/rust/library/std f64/impl#[f64]rem_euclid().(a, b)
198 }
199 }
200
201 #[cfg(any(feature = "libm", all(feature = "nostd-libm", not(feature = "std"))))]
202 pub(craterust-analyzer cargo glam 0.29.3 crate/) use libm_math::*;
203
204 #[cfg(all(not(feature = "libm"), feature = "std"))]
205 pub(craterust-analyzer cargo glam 0.29.3 crate/) use std_mathrust-analyzer cargo glam 0.29.3 f64/math/std_math/::*;