This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: IEEE128 binary float to decimal float conversion routines


On Thu, 19 Nov 2015, Steve Munroe wrote:

> Trying again. Please take some time to study PowerISA-2.07B :Book I Decimal
> Floating-Point (DFP)
> Facility Overview" and consider the implications that Decimal unit has
> rounding modes that separate and independent of binary float. And the one
> of the rounding modes is "Round to Prepare for Shorter Precision".
> 
> This seems to be the decimal analog of round to odd ?

Yes, it is, but it doesn't help here.  What it helps for is implementing 
formatOf arithmetic operations that take wider operands and round just 
once to narrower precision *with the same radix*, such as d32muld64 from 
TS 18661-2 - you'd do the multiplication in decimal64 format using that 
mode, restore the original mode and do the conversion to decimal32 in the 
original mode (and it can also be used in implementing fma).  But when 
what you want to do doesn't have a DFP instruction that can use that 
rounding mode, or when you are producing a binary result and so the binary 
rounding mode is the relevant rounding mode and you essentially need all 
decimal computations to be exact, it doesn't solve your problem.

In other words: if you had a DFP instruction "convert decimal128 to 
binary64, using the decimal rounding mode", but no instruction "convert 
decimal128 to binary32, using the binary rounding mode", you could use the 
former, in the "Round to Prepare for Shorter Precision" mode, to implement 
the latter.  But you don't have such instructions, and I don't think this 
mode helps implement these particular conversions at all.

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]