Bitcoin Forum
December 10, 2016, 01:33:02 AM *
News: To be able to use the next phase of the beta forum software, please ensure that your email address is correct/functional.
 
   Home   Help Search Donate Login Register  
Pages: « 1 [2]  All
  Print  
Author Topic: Stop using floating point!  (Read 26365 times)
racerguy
Sr. Member
****
Offline Offline

Activity: 271


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


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.
grue
Global Moderator
Legendary
*
Offline Offline

Activity: 1932



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

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.

Tired of annoying signature ads? Ad block for signatures
genjix
Legendary
*
expert
Offline Offline

Activity: 1232


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

I think bitcoin using floats/doubles is frankly stupid.

https://bitcointalk.org/index.php?topic=4086.0
http://bitcoinmedia.com/merchant-developer-tutorial/
Steve
Hero Member
*****
Offline Offline

Activity: 868



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

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? https://bitpay.com
2112
Legendary
*
Offline Offline

Activity: 1708



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

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: http://speleotrove.com/decimal/

2) please compile this little C program using your recent C compiler:
Code:
#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: https://bitcointalk.org/index.php?topic=54382.0
Long-term mining prognosis: https://bitcointalk.org/index.php?topic=91101.0
Pages: « 1 [2]  All
  Print  
 
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!