AndrewB Posted November 22, 2004 ... at least according to most programming languages. I've actually known this for a while, but I felt like saying it now. 0 Share this post Link to post
insertwackynamehere Posted November 22, 2004 ... so what does it equal O_o 0 Share this post Link to post
AndrewB Posted November 22, 2004 0.30000000000000000004 or something like that. Therefore, the language will tell you that they're not equal. 0 Share this post Link to post
GooberMan Posted November 22, 2004 Meanwhile, in "learn your tech" land, most programmers attribute that to floating point inaccuracies. The FPU is great and fast for the most part, but is known to lose accuracy. In the case of the amount of digits there though, it appears to be a double precision floating point number, which is done in software (unless you're a shiny new 64 bit processor). If you really want accuracy with your fractional numbers, try fixed point processing (stability traded off with flexibility). 0 Share this post Link to post
DooMBoy Posted November 22, 2004 That's just wonderful, AndrewB. I feel so enlightened. 0 Share this post Link to post
AndrewB Posted November 22, 2004 Fixed point processing is basically just using integers that are divided by whatever. 0 Share this post Link to post
GooberMan Posted November 22, 2004 The most common implementations are divided by powers of two. There are a few other methods some of which are explained in here. Fun fact: the PS2's main processor (the EE) has no FPU. All operations are done in fixed point arithmetic. Only the Vector Units perform operations in floating point arithmetic. I doubt most of you have access to a PS2, but you'll ********ly notice that this is true if you try something like 1.f / 60.f * 60.f on the EE as opposed to trying it on your PC. EDIT: Why the fuck is D E F I N A T E being starred out? 0 Share this post Link to post
GooberMan Posted November 22, 2004 Psyonisis said:Because it's spelled 'definite'. Not in Australia. 0 Share this post Link to post
Fredrik Posted November 22, 2004 GooberMan said:In the case of the amount of digits there though, it appears to be a double precision floating point number, which is done in software (unless you're a shiny new 64 bit processor).Uhh no, 32-bit x86 processors (and many others) do floating-point math with 80 bits precision in hardware. And of course, since 0.1 can't be represented accurately as a binary fraction no matter how many bits you use, it doesn't matter if a float or double or quad is used. If precision is needed, use ints (multiplying all values by 100 or whatever first) or a decimal type instead. 0 Share this post Link to post
AndrewB Posted November 22, 2004 GooberMan said:Not in Australia. Are you serious? 0 Share this post Link to post
Bloodshedder Posted November 22, 2004 AndrewB said:0.30000000000000000004This is (un)commonly known as the epsilon error. 0 Share this post Link to post
AndrewB Posted November 22, 2004 There is one fundamental reason why this occurs. Can anyone say what it is? 0 Share this post Link to post
Szymanski Posted November 22, 2004 The IEEE 754 standard is a method of storing floating-point numbers in a compact way that is easy to manipulate. This standard is used by Intel coprocessors and most PC-based programs that implement floating-point math. IEEE 754 specifies that numbers be stored in binary format to reduce storage requirements and allow the built-in binary arithmetic instructions that are available on all microprocessors to process the data in a relatively rapid fashion. However, some numbers that are simple, nonrepeating decimal numbers are converted into repeating binary numbers that cannot be stored with perfect accuracy. For example, the number 1/10 can be represented in a decimal number system with a simple decimal: .1 However, the same number in binary format becomes the repeating binary decimal: .0001100011000111000111 (and so on) This number cannot be represented in a finite amount of space. Therefore, this number is rounded down by approximately -2.78E-17 when it is stored. If several arithmetic operations are performed to obtain a given result, these rounding errors may be cumulative. 0 Share this post Link to post
Fredrik Posted November 22, 2004 AndrewB said:There is one fundamental reason why this occurs. Can anyone say what it is? Yes.Fredrik said:0.1 can't be represented accurately as a binary fraction no matter how many bits you use 0 Share this post Link to post
Planky Posted November 22, 2004 GooberMan said:Not in Australia. Not even Australians are that dumb. 0 Share this post Link to post
Ultraviolet Posted November 22, 2004 Captain Red said:because ling is a big jerk. I'd like it if people learned to fucking spell. Ling's done a good thing. 0 Share this post Link to post
AndrewB Posted November 22, 2004 Syzmanski wins the award. ... However, I believe the binary number for 1/10 is 0.00011001100 ... not whatever it was you said. 0 Share this post Link to post
Fredrik Posted November 22, 2004 I said it first, damnit. And he cheated. 0 Share this post Link to post
Szymanski Posted November 22, 2004 I sorta cheated, I've had it explained before by the guy who writes the drivers for our hardware. But it's easier to copy+paste. 0 Share this post Link to post
Darkhaven Posted November 22, 2004 Captain Red said:because ling is a big jerk. WRONG GooberMan said:Not in Australia. Any other wierd ways to spell words you'd like to share with us? 0 Share this post Link to post
GooberMan Posted November 22, 2004 Fredrik said:Uhh no, 32-bit x86 processors (and many others) do floating-point math with 80 bits precision in hardware.Oops. I remembered the FPU did processing with 80 bits, dunno why I thought it did double in software. Everyone said:Australian spelling differences There are plenty. Jail is spelt gaol for example. Civilization is spelt civilisation (in fact, many words with a z similar to above is spelt with an s). 0 Share this post Link to post
SteelPH Posted November 23, 2004 Captain Red said:because ling is a big jerk. Or he's prejudice against Australians. 0 Share this post Link to post
Relica Religia Posted November 23, 2004 Bloodshedder said:This is (un)commonly known as the epsilon error. I call it racism. All numbers are not equal? FOR SHAME. 0 Share this post Link to post
Bucket Posted November 23, 2004 fraggle said:0.99999999999.... = 1 ARGH ARGH ARGH ARGH ARGH ARGH ARGH CLOSE THREAD NOW For the love of God before the head explosions begin ARGH ARGH ARGH ARGH ARGH ARGH ARGH 0 Share this post Link to post
Fredrik Posted November 24, 2004 fraggle said:0.99999999999.... = 1 Then I take it 3 = 1 × 3 = 0.99999999... × 3 = 2.9999999....997, mister clever? 0 Share this post Link to post
Captain Red Posted November 24, 2004 Ling is an arse and should definately definitely go to gaol for his Prejudice ageist Australians. Anyway, I’ve got to put some Petrol in the car (it can go up to 160 kilometres per hour!) and paint the house a different colour. After that, I think I’ll play Medal of Honour, or maybe some Zed-doom. :P Paaaaaaaaach the caaaaaaaaaaaaaaaaaant! 0 Share this post Link to post