math_adapter/abs/
nan_like.rs1pub( crate ) mod private
7{
8 use crate::*;
9
10 pub trait NanLikeInterface
15 {
16 fn make_nan_like() -> Self;
18 fn is_nan( &self ) -> bool;
20 }
21
22 macro_rules! impl_nan_like_for_integer
25 {
26 (
27 $( $Args : tt )*
28 ) =>
29 {
30 impl NanLikeInterface for $( $Args )*
31 {
32 #[ inline ]
33 fn make_nan_like() -> Self
34 {
35 0
36 }
37 #[ inline ]
38 fn is_nan( &self ) -> bool
39 {
40 false
41 }
42 }
43 };
44 }
45
46 macro_rules! impl_nan_like_for_float
49 {
50 (
51 $( $Args : tt )*
52 ) =>
53 {
54 impl NanLikeInterface for $( $Args )*
55 {
56 #[ inline ]
57 fn make_nan_like() -> Self
58 {
59 < $( $Args )* >::NAN
60 }
61 #[ inline ]
62 fn is_nan( &self ) -> bool
63 {
64 *self == < $( $Args )* >::NAN
65 }
66 }
67 };
68 }
69
70 for_each_int!( impl_nan_like_for_integer );
71 for_each_float!( impl_nan_like_for_float );
72
73}
74
75crate::mod_interface!
76{
77 prelude use NanLikeInterface;
78}