[haiku-bugs] [Haiku] #7174: Decimal Floating Point support

  • From: "fano" <trac@xxxxxxxxxxxx>
  • Date: Fri, 28 Jan 2011 20:20:57 -0000

#7174: Decimal Floating Point support
----------------------------+------------------------
   Reporter:  fano          |       Owner:  nobody
       Type:  enhancement   |      Status:  new
   Priority:  normal        |   Milestone:  R1
  Component:  System/POSIX  |     Version:  R1/alpha2
   Keywords:                |  Blocked By:
Has a Patch:  0             |    Platform:  All
   Blocking:                |
----------------------------+------------------------
 In these days I was working (on Linux) on an application in which I have
 to represent currency and seemed natural to me to use double to represent
 it!
 A great mistake now I know... double simply not work (that is I have 0.05
 I multiply for 2 and obtain... 0.09 not 0.10!).

 I have found that there is a new _Decimal type in the work and GCC say it
 is included from GCC 4.2, but sadly is not compiled by default... so in
 Linux it says: _Decimal32 not found! ... and I've to re-write to use
 integer and divide by 100 for visualization :-(

 I've tried this simple C code on Haiku and it is better:


 {{{
 #include <stdio.h>

 int
 main(void) {
     _Decimal32 d = 4.0;

      return 0;
 }
 }}}

 GCC says: << decimal floating point not supported for this target >>

 Better that Linux that says _Decimal32 not exist! But why is not
 supported?
 This support can be added? I think Decimal Floating point could be very
 useful if you want precise decimal calculation...

 For references:

 http://gcc.gnu.org/onlinedocs/gcc/Decimal-Float.html

-- 
Ticket URL: <http://dev.haiku-os.org/ticket/7174>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: