floats bug?

Just starting out? Need help? Post your questions and find answers here.
denise_amiga
New User
New User
Posts: 7
Joined: Fri Sep 09, 2005 5:27 pm

floats bug?

Post by denise_amiga »

Code: Select all

    #count = 10000000
    x.f = 1
    y.f = 1.000001
    For i = 1 To #count
        x = x * y
    Next
    Debug x
    
    xx.d = 1
    yy.d = 1.000001
    For i = 1 To #count
        xx = xx * yy
    Next
    Debug xx
x = 13669.287109375
xx = 22026.355644709398
Last edited by denise_amiga on Wed Jul 26, 2006 1:36 pm, edited 3 times in total.
Pupil
Enthusiast
Enthusiast
Posts: 715
Joined: Fri Apr 25, 2003 3:56 pm

Post by Pupil »

that's why you use doubles if you want better precision...
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

A small error multiplied by a big number is finally a big error. 8)
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
Post Reply