Skip to content

Commit bd405fb

Browse files
bogglebrson
authored andcommitted
std: math now declares libm dependencies as pure
1 parent 9c9be62 commit bd405fb

File tree

1 file changed

+60
-60
lines changed

1 file changed

+60
-60
lines changed

src/lib/math.rs

Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,26 @@ native mod f64 {
2424

2525
// Alpabetically sorted by link_name
2626

27-
fn acos(n: f64) -> f64;
28-
fn asin(n: f64) -> f64;
29-
fn atan(n: f64) -> f64;
30-
fn atan2(a: f64, b: f64) -> f64;
31-
fn ceil(n: f64) -> f64;
32-
fn cos(n: f64) -> f64;
33-
fn cosh(n: f64) -> f64;
34-
fn exp(n: f64) -> f64;
35-
#[link_name="fabs"] fn abs(n: f64) -> f64;
36-
fn floor(n: f64) -> f64;
37-
#[link_name="log"] fn ln(n: f64) -> f64;
38-
#[link_name="log1p"] fn ln1p(n: f64) -> f64;
39-
fn log10(n: f64) -> f64;
40-
fn log2(n: f64) -> f64;
41-
fn pow(n: f64, e: f64) -> f64;
42-
fn sin(n: f64) -> f64;
43-
fn sinh(n: f64) -> f64;
44-
fn sqrt(n: f64) -> f64;
45-
fn tan(n: f64) -> f64;
46-
fn tanh(n: f64) -> f64;
27+
pure fn acos(n: f64) -> f64;
28+
pure fn asin(n: f64) -> f64;
29+
pure fn atan(n: f64) -> f64;
30+
pure fn atan2(a: f64, b: f64) -> f64;
31+
pure fn ceil(n: f64) -> f64;
32+
pure fn cos(n: f64) -> f64;
33+
pure fn cosh(n: f64) -> f64;
34+
pure fn exp(n: f64) -> f64;
35+
#[link_name="fabs"] pure fn abs(n: f64) -> f64;
36+
pure fn floor(n: f64) -> f64;
37+
#[link_name="log"] pure fn ln(n: f64) -> f64;
38+
#[link_name="log1p"] pure fn ln1p(n: f64) -> f64;
39+
pure fn log10(n: f64) -> f64;
40+
pure fn log2(n: f64) -> f64;
41+
pure fn pow(n: f64, e: f64) -> f64;
42+
pure fn sin(n: f64) -> f64;
43+
pure fn sinh(n: f64) -> f64;
44+
pure fn sqrt(n: f64) -> f64;
45+
pure fn tan(n: f64) -> f64;
46+
pure fn tanh(n: f64) -> f64;
4747
}
4848

4949
#[link_name = "m"]
@@ -52,26 +52,26 @@ native mod f32 {
5252

5353
// Alpabetically sorted by link_name
5454

55-
#[link_name="acosf"] fn acos(n: f32) -> f32;
56-
#[link_name="asinf"] fn asin(n: f32) -> f32;
57-
#[link_name="atanf"] fn atan(n: f32) -> f32;
58-
#[link_name="atan2f"] fn atan2(a: f32, b: f32) -> f32;
59-
#[link_name="ceilf"] fn ceil(n: f32) -> f32;
60-
#[link_name="cosf"] fn cos(n: f32) -> f32;
61-
#[link_name="coshf"] fn cosh(n: f32) -> f32;
62-
#[link_name="expf"] fn exp(n: f32) -> f32;
63-
#[link_name="fabsf"] fn abs(n: f32) -> f32;
64-
#[link_name="floorf"] fn floor(n: f32) -> f32;
65-
#[link_name="powf"] fn pow(n: f32, e: f32) -> f32;
66-
#[link_name="sinf"] fn sin(n: f32) -> f32;
67-
#[link_name="sinhf"] fn sinh(n: f32) -> f32;
68-
#[link_name="sqrtf"] fn sqrt(n: f32) -> f32;
69-
#[link_name="tanf"] fn tan(n: f32) -> f32;
70-
#[link_name="tanhf"] fn tanh(n: f32) -> f32;
71-
#[link_name="logf"] fn ln(n: f32) -> f32;
72-
#[link_name="log1p"] fn ln1p(n: f64) -> f64;
73-
#[link_name="log2f"] fn log2(n: f32) -> f32;
74-
#[link_name="log10f"] fn log10(n: f32) -> f32;
55+
#[link_name="acosf"] pure fn acos(n: f32) -> f32;
56+
#[link_name="asinf"] pure fn asin(n: f32) -> f32;
57+
#[link_name="atanf"] pure fn atan(n: f32) -> f32;
58+
#[link_name="atan2f"] pure fn atan2(a: f32, b: f32) -> f32;
59+
#[link_name="ceilf"] pure fn ceil(n: f32) -> f32;
60+
#[link_name="cosf"] pure fn cos(n: f32) -> f32;
61+
#[link_name="coshf"] pure fn cosh(n: f32) -> f32;
62+
#[link_name="expf"] pure fn exp(n: f32) -> f32;
63+
#[link_name="fabsf"] pure fn abs(n: f32) -> f32;
64+
#[link_name="floorf"] pure fn floor(n: f32) -> f32;
65+
#[link_name="powf"] pure fn pow(n: f32, e: f32) -> f32;
66+
#[link_name="sinf"] pure fn sin(n: f32) -> f32;
67+
#[link_name="sinhf"] pure fn sinh(n: f32) -> f32;
68+
#[link_name="sqrtf"] pure fn sqrt(n: f32) -> f32;
69+
#[link_name="tanf"] pure fn tan(n: f32) -> f32;
70+
#[link_name="tanhf"] pure fn tanh(n: f32) -> f32;
71+
#[link_name="logf"] pure fn ln(n: f32) -> f32;
72+
#[link_name="log1p"] pure fn ln1p(n: f64) -> f64;
73+
#[link_name="log2f"] pure fn log2(n: f32) -> f32;
74+
#[link_name="log10f"] pure fn log10(n: f32) -> f32;
7575
}
7676

7777

@@ -189,23 +189,23 @@ Function: acos
189189
Returns the arccosine of an angle (measured in rad)
190190
*/
191191
pure fn acos(x: float) -> float
192-
{ unsafe { c_float::acos(x as c_float) as float } }
192+
{ c_float::acos(x as c_float) as float }
193193

194194
/*
195195
Function: asin
196196
197197
Returns the arcsine of an angle (measured in rad)
198198
*/
199199
pure fn asin(x: float) -> float
200-
{ unsafe { c_float::asin(x as c_float) as float } }
200+
{ c_float::asin(x as c_float) as float }
201201

202202
/*
203203
Function: atan
204204
205205
Returns the arctangents of an angle (measured in rad)
206206
*/
207207
pure fn atan(x: float) -> float
208-
{ unsafe { c_float::atan(x as c_float) as float } }
208+
{ c_float::atan(x as c_float) as float }
209209

210210

211211
/*
@@ -214,7 +214,7 @@ Function: atan2
214214
Returns the arctangent of an angle (measured in rad)
215215
*/
216216
pure fn atan2(y: float, x: float) -> float
217-
{ unsafe { c_float::atan2(y as c_float, x as c_float) as float } }
217+
{ c_float::atan2(y as c_float, x as c_float) as float }
218218

219219
/*
220220
Function: ceil
@@ -224,15 +224,15 @@ Returns:
224224
The smallest integral value less than or equal to `n`
225225
*/
226226
pure fn ceil(n: float) -> float
227-
{ unsafe { c_float::ceil(n as c_float) as float } }
227+
{ c_float::ceil(n as c_float) as float }
228228

229229
/*
230230
Function: cos
231231
232232
Returns the cosine of an angle `x` (measured in rad)
233233
*/
234234
pure fn cos(x: float) -> float
235-
{ unsafe { c_float::cos(x as c_float) as float } }
235+
{ c_float::cos(x as c_float) as float }
236236

237237
/*
238238
Function: cosh
@@ -241,7 +241,7 @@ Returns the hyperbolic cosine of `x`
241241
242242
*/
243243
pure fn cosh(x: float) -> float
244-
{ unsafe { c_float::cosh(x as c_float) as float } }
244+
{ c_float::cosh(x as c_float) as float }
245245

246246

247247
/*
@@ -252,7 +252,7 @@ Returns:
252252
e to the power of `n*
253253
*/
254254
pure fn exp(n: float) -> float
255-
{ unsafe { c_float::exp(n as c_float) as float } }
255+
{ c_float::exp(n as c_float) as float }
256256

257257
/*
258258
Function: abs
@@ -263,7 +263,7 @@ The absolute value of `n`
263263
264264
*/
265265
pure fn abs(n: float) -> float
266-
{ unsafe { c_float::abs(n as c_float) as float } }
266+
{ c_float::abs(n as c_float) as float }
267267

268268
/*
269269
Function: floor
@@ -273,15 +273,15 @@ Returns:
273273
The largest integral value less than or equal to `n`
274274
*/
275275
pure fn floor(n: float) -> float
276-
{ unsafe { c_float::floor(n as c_float) as float } }
276+
{ c_float::floor(n as c_float) as float }
277277

278278
/*
279279
Function: ln
280280
281281
Returns the natural logaritm of `n`
282282
*/
283283
pure fn ln(n: float) -> float
284-
{ unsafe { c_float::ln(n as c_float) as float } }
284+
{ c_float::ln(n as c_float) as float }
285285

286286
/*
287287
Function: ln1p
@@ -290,29 +290,29 @@ Returns the natural logarithm of `1+n` accurately,
290290
even for very small values of `n`
291291
*/
292292
pure fn ln1p(n: float) -> float
293-
{ unsafe { c_float::ln1p(n as c_float) as float } }
293+
{ c_float::ln1p(n as c_float) as float }
294294

295295
/*
296296
Function: log10
297297
298298
Returns the logarithm to base 10 of `n`
299299
*/
300300
pure fn log10(n: float) -> float
301-
{ unsafe { c_float::log10(n as c_float) as float } }
301+
{ c_float::log10(n as c_float) as float }
302302

303303
/*
304304
Function: log2
305305
306306
Returns the logarithm to base 2 of `n`
307307
*/
308308
pure fn log2(n: float) -> float
309-
{ unsafe { c_float::log2(n as c_float) as float } }
309+
{ c_float::log2(n as c_float) as float }
310310

311311
/*
312312
Function: pow
313313
*/
314314
pure fn pow(v: float, e: float) -> float
315-
{ unsafe { c_float::pow(v as c_float, e as c_float) as float } }
315+
{ c_float::pow(v as c_float, e as c_float) as float }
316316

317317

318318
/*
@@ -321,23 +321,23 @@ Function: sin
321321
Returns the sine of an angle `x` (measured in rad)
322322
*/
323323
pure fn sin(x: float) -> float
324-
{ unsafe { c_float::sin(x as c_float) as float } }
324+
{ c_float::sin(x as c_float) as float }
325325

326326
/*
327327
Function: sinh
328328
329329
Returns the hyperbolic sine of an angle `x` (measured in rad)
330330
*/
331331
pure fn sinh(x: float) -> float
332-
{ unsafe { c_float::sinh(x as c_float) as float } }
332+
{ c_float::sinh(x as c_float) as float }
333333

334334
/*
335335
Function: sqrt
336336
337337
Returns the square root of `x`
338338
*/
339339
pure fn sqrt(x: float) -> float
340-
{ unsafe { c_float::sqrt(x as c_float) as float } }
340+
{ c_float::sqrt(x as c_float) as float }
341341

342342
/*
343343
Function: tan
@@ -346,7 +346,7 @@ Returns the tangent of an angle `x` (measured in rad)
346346
347347
*/
348348
pure fn tan(x: float) -> float
349-
{ unsafe { c_float::tan(x as c_float) as float } }
349+
{ c_float::tan(x as c_float) as float }
350350

351351
/*
352352
Function: tanh
@@ -355,7 +355,7 @@ Returns the hyperbolic tangent of an angle `x` (measured in rad)
355355
356356
*/
357357
pure fn tanh(x: float) -> float
358-
{ unsafe { c_float::tanh(x as c_float) as float } }
358+
{ c_float::tanh(x as c_float) as float }
359359

360360

361361

0 commit comments

Comments
 (0)