Bitcoin Forum
June 20, 2018, 02:39:17 AM *
News: Latest stable version of Bitcoin Core: 0.16.1  [Torrent]. (New!)
   Home   Help Search Donate Login Register  
Pages: « 1 [2]  All
Author Topic: Stop using floating point!  (Read 28105 times)
Sr. Member
Offline Offline

Activity: 270
Merit: 250

View Profile
February 13, 2012, 03:07:33 AM

Thanks I've been waiting over 7months to click that link.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
Hero Member
Offline Offline

Posts: 1529462357

View Profile Personal Message (Offline)

Reply with quote  #2

Report to moderator
Global Moderator
Offline Offline

Activity: 2100
Merit: 1138

View Profile
February 13, 2012, 03:28:59 AM

From what i can tell, bitcoinhelper (lol @ "helper") is just randomly quoting pieces of code and ranting about how we shouldn't use floats for everything. but for some reason, he didn't realize that floats are only used in GUI related stuff.

something tells me that he is either a kid who gets really hyped up about small issues (looks like he made an account just to post this topic Roll Eyes), or a troll.

and he's a necro  Angry

It is pitch black. You are likely to be eaten by a grue.

Adblock for annoying signature ads | Enhanced Merit UI
Offline Offline

Activity: 1232
Merit: 1000

View Profile
February 13, 2012, 04:29:54 PM

I think bitcoin using floats/doubles is frankly stupid.
Hero Member
Offline Offline

Activity: 868
Merit: 1000

View Profile WWW
February 17, 2012, 04:50:48 AM

This debate is silly.  If you're really a purist, forget scaled decimal and use integers and fractions.  Smalltalk was invented in the 70's and by default, it preserves the original representation of numbers...  "1 / 2" yields a fraction with the integer 1 as the numerator and 2 as the denominator.  Multitply it by 3 and you get another fraction, "3 / 2".  Multiply that by 2 and you get the integer "3" (yes, it reduces fractions).  You don't get better precision than that.  A 64bit floating point number has plenty of precision to deal with anything bitcoin needs…try "21000000.00000002 / 2" …it works.  When working with floating point within its bounds of precision, you only need to know enough about math to know when it's appropriate to round.

(gasteve on IRC) Does your website accept cash?
Offline Offline

Activity: 2114
Merit: 1027

View Profile
February 17, 2012, 06:44:10 PM

This thread is very sad. Bitcoin is seriously affected with not-invented-here-itis. I personally started to think that the current milieu here is hopeless. The only hope is that the currently involved software designers fall of the face of the Earth's Internet and get replaced by a new blood.

On the other hand I also know that a lot of bright young people read this forum. So for the benefit of the young blood:

1) please learn the difference between binary floating point and decimal floating point. The good starting point is:

2) please compile this little C program using your recent C compiler:
#include <stdio.h>
int main()
        _Decimal32 x,y;

        x = 1.df;
        x /= 10.df;
        y = x;
        y *= 10.df;
        printf("%Hf %Hf\n",x,y);
        return 0;
For example: "gcc d.c -ldfp". If you get "library not found for -ldfp" error, then read the following and complain to your software vendor.

3) You became a collateral damage in the mortal combat between IBM and Intel. They are both pushing two incompatible implementations of decimal floating point: IBM's DPD (densely packed decimal) and Intel's BID (binary integer decimal). The libdfp code is out there on the Internet, you'll need to search for it in places that aren't easily accessible to lawyers of the two concerns that I named above.

Please comment, critique, criticize or ridicule BIP 2112:
Long-term mining prognosis:
Pages: « 1 [2]  All
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!