@@ -43,7 +43,12 @@ pub type Result<T> = result::Result<T, IntervalError>;
4343/// An interval with [`f64`] bounds.
4444///
4545/// It is sometimes referred to as a *bare* interval in contrast to a decorated interval ([`DecInterval`]).
46- #[ derive( Clone , Copy , Debug ) ]
46+ ///
47+ /// Note that, for convenience, the [`Debug`][std::fmt::Debug] output
48+ /// looks like `Interval(a, b)`, where `a` and `b` are the [`f64`]
49+ /// bounds of the interval, although, internally, intervals are not
50+ /// defined as a struct. Empty intervals are written as `Interval(NaN, NaN)`.
51+ #[ derive( Clone , Copy ) ]
4752#[ repr( C ) ]
4853pub struct Interval {
4954 // An interval is stored in a SIMD vector in the neginf-sup-nan form:
@@ -55,16 +60,20 @@ pub struct Interval {
5560 //
5661 // Representations of zeros and NaNs are arbitrary; a zero can be either +0.0 or -0.0,
5762 // and a NaN can be either a qNaN or a sNaN with an arbitrary payload.
58- //
59- // In Debug formatting, the value of `rep` is printed as either
60- // `__m128d(-a, b)` (on x86-64) or `float64x2_t(-a, b)` (on AArch64).
6163 pub ( crate ) rep : F64X2 ,
6264}
6365
6466unsafe impl Send for Interval { }
6567unsafe impl Sync for Interval { }
6668impl Unpin for Interval { }
6769
70+ impl fmt:: Debug for Interval {
71+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
72+ let [ a, b] = extract ( self . rep ) ;
73+ f. debug_tuple ( "Interval" ) . field ( & -a) . field ( & b) . finish ( )
74+ }
75+ }
76+
6877impl Interval {
6978 pub ( crate ) fn inf_raw ( self ) -> f64 {
7079 -extract0 ( self . rep )
0 commit comments