[haiku-development] gcc enable _Decimal32, _Deimal64 and _Decimal128 (and g++ decimal32, ...) support

  • From: fano il primo <fanoilprimo@xxxxxxxxx>
  • To: haiku-development <haiku-development@xxxxxxxxxxxxx>
  • Date: Sat, 3 Dec 2011 21:16:48 +0100

In #7174 (https://dev.haiku-os.org/ticket/7174) I've requested to add
decimal floating point support.
As you can see I've tried to recompile GCC with GCC itself, but sadly I
failed old GCC does not want re-compile itself saying it doesn't know
_Decimal32... but I'm compiling for this, right? Pretty confusing, I know,
but I'm confused, too :-)

So you can add decimal floating point support? double/float are not
realiable for monetary calculations (let's try this: int a = (0.3 * 3  *
100.00) what you get? You get not 1  but 0 (!)
as you get  0.999999999999999748 that trucated to an int become 0!)

A note GNU has done an incomplete work (strange) it added _Decimal32 and
all, but printf(), fprintf, sscan() and friends not have a _Decimal32
converter... IBM has them
(%D, %DD, ...) as you can say here:
http://publib.boulder.ibm.com/infocenter/zos/v1r12/index.jsp?topic=%2Fcom.ibm.zos.r12.bpxbd00%2Frasind.htm

I suppose BSD printf() and all are correct... ahh you could need strtod32()
too:
http://publib.boulder.ibm.com/infocenter/zos/v1r12/index.jsp?topic=%2Fcom.ibm.zos.r12.bpxbd00%2Frasind.htm

Note for C++, you need GCC >= 4.6 as they're not native types (I can't
simply understand why???) but classes (decimal32, decimal64, decimal128).

Thanks for the attention,
bye fano

Other related posts: