File tree Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Original file line number Diff line number Diff line change 2
2
members = [" fuzz" ]
3
3
4
4
[workspace .package ]
5
- version = " 0.2.1+llvm-3d11652bbee4 "
5
+ version = " 0.2.1+llvm-69668590592f "
6
6
edition = " 2021"
7
7
license = " Apache-2.0 WITH LLVM-exception"
8
8
Original file line number Diff line number Diff line change @@ -576,6 +576,24 @@ impl<S: Semantics> Neg for IeeeFloat<S> {
576
576
}
577
577
}
578
578
579
+ impl < Src : Semantics > IeeeFloat < Src > {
580
+ /// Returns true if any number described by `Self` can be precisely represented
581
+ /// by a normal (not subnormal) value in `IeeeFloat<Dst>`.
582
+ pub const fn is_representable_as_normal_in < Dst : Semantics > ( ) -> bool {
583
+ // Exponent range must be larger.
584
+ if Src :: MAX_EXP >= Dst :: MAX_EXP || Src :: MIN_EXP <= Dst :: MIN_EXP {
585
+ return false ;
586
+ }
587
+
588
+ // If the mantissa is long enough, the result value could still be denormal
589
+ // with a larger exponent range.
590
+ //
591
+ // FIXME: This condition is probably not accurate but also shouldn't be a
592
+ // practical concern with existing types.
593
+ return Dst :: PRECISION >= Src :: PRECISION ;
594
+ }
595
+ }
596
+
579
597
/// Prints this value as a decimal string.
580
598
///
581
599
/// \param precision The maximum number of digits of
Original file line number Diff line number Diff line change 1
1
//! Port of LLVM's APFloat software floating-point implementation from the
2
2
//! following C++ sources (please update commit hash when backporting):
3
- //! <https://github.com/llvm/llvm-project/commit/3d11652bbee4cd6782c474e28cb2ab58fc93f245 >
3
+ //! <https://github.com/llvm/llvm-project/commit/69668590592fcca2c2b22ba2257be57f0319fc9c >
4
4
//! * `llvm/include/llvm/ADT/APFloat.h` -> `Float` and `FloatConvert` traits
5
5
//! * `llvm/lib/Support/APFloat.cpp` -> `ieee` and `ppc` modules
6
6
//! * `llvm/unittests/ADT/APFloatTest.cpp` -> `tests` directory
You can’t perform that action at this time.
0 commit comments