Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit 2d3bd6c

Browse files
committed
Combine fmin{,f,f16,f128} and fmax{,f,f16,128} into a single file
These don't have much content since they now use the generic implementation. There will be more similar functions in the near future (fminimum, fmaximum, fminimum_num, fmaximum_num); start the pattern of combining similar functions now so we don't have to eventually maintain similar docs across 24 different files.
1 parent 90872c1 commit 2d3bd6c

File tree

11 files changed

+65
-64
lines changed

11 files changed

+65
-64
lines changed

etc/function-definitions.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -365,56 +365,56 @@
365365
},
366366
"fmax": {
367367
"sources": [
368-
"src/math/fmax.rs",
368+
"src/math/fmin_fmax.rs",
369369
"src/math/generic/fmax.rs"
370370
],
371371
"type": "f64"
372372
},
373373
"fmaxf": {
374374
"sources": [
375-
"src/math/fmaxf.rs",
375+
"src/math/fmin_fmax.rs",
376376
"src/math/generic/fmax.rs"
377377
],
378378
"type": "f32"
379379
},
380380
"fmaxf128": {
381381
"sources": [
382-
"src/math/fmaxf128.rs",
382+
"src/math/fmin_fmax.rs",
383383
"src/math/generic/fmax.rs"
384384
],
385385
"type": "f128"
386386
},
387387
"fmaxf16": {
388388
"sources": [
389-
"src/math/fmaxf16.rs",
389+
"src/math/fmin_fmax.rs",
390390
"src/math/generic/fmax.rs"
391391
],
392392
"type": "f16"
393393
},
394394
"fmin": {
395395
"sources": [
396-
"src/math/fmin.rs",
396+
"src/math/fmin_fmax.rs",
397397
"src/math/generic/fmin.rs"
398398
],
399399
"type": "f64"
400400
},
401401
"fminf": {
402402
"sources": [
403-
"src/math/fminf.rs",
403+
"src/math/fmin_fmax.rs",
404404
"src/math/generic/fmin.rs"
405405
],
406406
"type": "f32"
407407
},
408408
"fminf128": {
409409
"sources": [
410-
"src/math/fminf128.rs",
410+
"src/math/fmin_fmax.rs",
411411
"src/math/generic/fmin.rs"
412412
],
413413
"type": "f128"
414414
},
415415
"fminf16": {
416416
"sources": [
417-
"src/math/fminf16.rs",
417+
"src/math/fmin_fmax.rs",
418418
"src/math/generic/fmin.rs"
419419
],
420420
"type": "f16"

src/math/fmax.rs

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/math/fmaxf.rs

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/math/fmaxf128.rs

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/math/fmaxf16.rs

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/math/fmin.rs

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/math/fmin_fmax.rs

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/// Return the lesser of two arguments or, if either argument is NaN, the other argument.
2+
#[cfg(f16_enabled)]
3+
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
4+
pub fn fminf16(x: f16, y: f16) -> f16 {
5+
super::generic::fmin(x, y)
6+
}
7+
8+
/// Return the lesser of two arguments or, if either argument is NaN, the other argument.
9+
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
10+
pub fn fminf(x: f32, y: f32) -> f32 {
11+
super::generic::fmin(x, y)
12+
}
13+
14+
/// Return the lesser of two arguments or, if either argument is NaN, the other argument.
15+
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
16+
pub fn fmin(x: f64, y: f64) -> f64 {
17+
super::generic::fmin(x, y)
18+
}
19+
20+
/// Return the lesser of two arguments or, if either argument is NaN, the other argument.
21+
#[cfg(f128_enabled)]
22+
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
23+
pub fn fminf128(x: f128, y: f128) -> f128 {
24+
super::generic::fmin(x, y)
25+
}
26+
27+
/// Return the greater of two arguments or, if either argument is NaN, the other argument.
28+
#[cfg(f16_enabled)]
29+
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
30+
pub fn fmaxf16(x: f16, y: f16) -> f16 {
31+
super::generic::fmax(x, y)
32+
}
33+
34+
/// Return the greater of two arguments or, if either argument is NaN, the other argument.
35+
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
36+
pub fn fmaxf(x: f32, y: f32) -> f32 {
37+
super::generic::fmax(x, y)
38+
}
39+
40+
/// Return the greater of two arguments or, if either argument is NaN, the other argument.
41+
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
42+
pub fn fmax(x: f64, y: f64) -> f64 {
43+
super::generic::fmax(x, y)
44+
}
45+
46+
/// Return the greater of two arguments or, if either argument is NaN, the other argument.
47+
#[cfg(f128_enabled)]
48+
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
49+
pub fn fmaxf128(x: f128, y: f128) -> f128 {
50+
super::generic::fmax(x, y)
51+
}

src/math/fminf.rs

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/math/fminf128.rs

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/math/fminf16.rs

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)