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

  • From: Ingo Weinhold <ingo_weinhold@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Tue, 06 Dec 2011 21:44:43 +0100

On 2011-12-06 at 09:54:46 [+0100], fano il primo <fanoilprimo@xxxxxxxxx> 
> Yes me too had the impression the problem is not well understood... I do
> not pretend that 100.00 / 3.00 give me a sensate result but on
> the other hand 0.60 /3.00 should give me 0.20 and not
> 0.199999999999999999999999999999999978, right?
> It's this problem the IEEE decimal floating point standard tries to solve:
> do right math with the number naturally used by human beings
> not by 'puters...
> So we've 100/3 it 's not representable ( as it does 33.33333(3) ), but 0.6
> /3 it is; as in decimal you don't obtain a periodical or transcendent
> number.

As has already been written by others, if you only want to solve that issue, 
just represent cents instead of USD/EUR.

As has already been written by Axel, the floating point decimal support in 
gcc is subject to change. The gcc 4.6.2 manual also documents it as such (and 
incomplete, BTW). Until that changes, I wouldn't consider enabling it.

CU, Ingo

Other related posts: