Sirish Pande
2012-Mar-05 07:56 UTC
[LLVMdev] printing hex format for floating point number
Hi, I am trying to print a hex value ( 4111999A for 9.1) for a corresponding floating point number. The routine convertToHexString in APFFloat class only prints in C99 Floating point hexagondecimal constant (eg 1.e00000p3). Without writing my own routine, how do I get to print the hexadecimal representation for a floating point value? Sirish -- Qualcomm Innovation Center, Inc is a member of Code Aurora Forum -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120305/6dae85a2/attachment.html>
Jim Grosbach
2012-Mar-06 21:48 UTC
[LLVMdev] printing hex format for floating point number
You can bitcast it to an integer of the same size and print that, I believe. APFloat::bitcastToAPInt(). -Jim On Mar 4, 2012, at 11:56 PM, Sirish Pande <spande at codeaurora.org> wrote:> Hi, > > I am trying to print a hex value ( 4111999A for 9.1) for a corresponding floating point number. The routine convertToHexString in APFFloat class only prints in C99 Floating point hexagondecimal constant (eg 1.e00000p3). > > Without writing my own routine, how do I get to print the hexadecimal representation for a floating point value? > > Sirish > -- > Qualcomm Innovation Center, Inc is a member of Code Aurora Forum > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120306/0b03155e/attachment.html>