erichkeane added a comment. In https://reviews.llvm.org/D46535#1253473, @xbolva00 wrote:
> Hello, @erichkeane > > I am working on int to float checker but I haven't found yet a way how to > check if integer fits to float's significant bits. Maybe you can recommend me > something? I already tried some LLVM APIs but no success. (cc @spatel as you > will probably know the right function to do it) I'm not sure what you mean by that... Every Integer is representable (lossy of course) as a float as far as I know. You'll obviously lose the LSDs, but it'll be representable. Are you trying to check whether it is round-trip-able? If thats the case, I think you'll need to make sure it entirely fits in the mantissa. You can get the amount of mantissa bits by checking the APFloat's fltSemantics. There are a couple of builtin ones that I think end up being useful, but the 'precision' field seems like what you want. Repository: rC Clang https://reviews.llvm.org/D46535 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits