[Implemented] Doubles

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

[Implemented] Doubles

Post by BackupUser »

Restored from previous forum. Originally posted by Paul.

Hey Fred,

When are we going to get accurate Floats... or Doubles ??

(and a Printer library?)


Edited by - paul on 29 January 2002 16:09:13
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by fred.

Since v2.90, you should get better accuracy on floats.

Your example
a=5.1
b=6.3

c = a+b returns 11.4.

About double, may be for the 3.0

Bye,

Fred - AlphaSND
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Paul.

Take a look at this Fred...

a.f=39.43
b.f=36.95
c.f=35.57
d.f=35.07
e.f=29.90
total.f=a+b+c+d+e
MessageRequester("Right",StrF(total,2),0)


total.f=39.43+36.95+35.57+35.07+29.90
MessageRequester("Wrong",StrF(total,2),0)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Franco.

This has also the wrong result:

MessageRequester("Wrong",StrF(39.43+36.95+35.57+35.07+29.90,2),0)



Have a nice day...
Franco

Sometimes you have to go a lonely way to accomplish genius things.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Manolo.
Take a look at this Fred...

a.f=39.43
b.f=36.95
c.f=35.57
d.f=35.07
e.f=29.90
total.f=a+b+c+d+e
MessageRequester("Right",StrF(total,2),0)


total.f=39.43+36.95+35.57+35.07+29.90
MessageRequester("Wrong",StrF(total,2),0)
And this other...

Code: Select all

OpenConsole()
a.f=6.31
b.f=4.22
PrintN(StrF(a*b,2))
a$=Input()
The exact result is=26.6282
Then if the precision is to 2 decimals, the correct result is: 26.63

Manolo
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Manolo.

Code: Select all

OpenConsole()
a.f=6.31
b.f=4.22
PrintN(StrF(a*b,2))
a$=Input()
The exact result is=26.6282
Then if the precision is to 2 decimals, the correct result is: 26.63

Manolo


[/quote]

a.f=6.31
b.f=4.22
PrintN(StrF(a*b,0))----> result with 0 decimals

Sniffffff. Result is: 26 (No rounded to superior) result correct: 27
Manolo
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by fred.

Yes, float have very poor precision. It's the same in C or C++.. I will try to add double asap.

Fred - AlphaSND
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Manolo.
Since v2.90, you should get better accuracy on floats.

Your example
a=5.1
b=6.3

c = a+b returns 11.4.

About double, may be for the 3.0

Bye,

Fred - AlphaSND
Fred,
Promise forgot
Sorry
Manolo
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by fred.

may be = not sure.

Fred - AlphaSND
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Manolo.
may be = not sure.

Fred - AlphaSND
Ok Fred,
I can wait another bit of time.
But, please, remember that this is very important for you star product.
Hapy weekend.
Manolo
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by GorkaTRON.
may be = not sure.

Fred - AlphaSND
Ok Fred,
I can wait another bit of time.
But, please, remember that this is very important for you star product.
Hapy weekend.
Manolo

(Lo siento Manolo por el plagio)

Oops. I don't know post new messages...

When will Doubles be available? I think it's very important for a good compiler Double support and it's very necessary for technical software, I use PureBasic for scientific programs and I don't have enough resolution with floats. I hope doubles will be available on 3.1 version.

^^GorkaTRON^^
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by nico.

Yeah Fred , PLEASE do!
I also need it BADLY!!!

Im making a euro calculator, and i have to work with numbers like 2.20371
Please , if those doubles are the solution of beeing able to work/calculate
with more numbers behind the comma/point , then please make it if possible!



Nico

- = Registered Purebasic User = -
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by nico.
Yes, float have very poor precision. It's the same in C or C++.. I will try to add double asap.

Fred - AlphaSND
Please Fred... Please ....!
Post Reply