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

  • From: Alex Wilson <yourpalal2@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sat, 3 Dec 2011 18:14:41 -0700

On Sat, Dec 3, 2011 at 1:16 PM, fano il primo <fanoilprimo@xxxxxxxxx> wrote:

> In #7174 (https://dev.haiku-os.org/ticket/7174) I've requested to add
> decimal floating point support.
>

Thanks, a ticket is enough, and if you have more information on your
request, please add the information there, so that anyone who is interested
can easily find the related discussion/info all in one place. I realise
that you haven't had any response in 10 months, but if you add a comment on
that ticket, anyone subscribed to the tickets mailing list will get a mail
about it.

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!)
>

I'm not going to comment on your request, but I can't help but be curious
about your calculations here. In short, I don't see why you would be
expecting to get a 1 as a result of that calculation. If you want rounding,
then use the round() functions. Why are you storing the result of a
floating-point calculation in an int, if the truncation is messing up your
calculations?

--Alex

Other related posts: