Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/20/24 01:28
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (7th_zorro), 793 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
digits variable inaccuracy? #306410
01/22/10 00:06
01/22/10 00:06
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline OP
Serious User
DJBMASTER  Offline OP
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
Don't know if this has come up before, but following the example in the manual for 'digits' gives wrong values...
Code:
var x = 123456.789;
...
digits(0,0,"%f",*,1,x);


According to the manual this will display '123456.789' yet I keep getting '123456.789063'. I realise this is caused by the inaccuracies in converting the var to floating point, but it's still a mistake in the manual.

Last edited by DJBMASTER; 01/22/10 04:18.
Re: digits variable inaccuracy? [Re: DJBMASTER] #306485
01/22/10 15:38
01/22/10 15:38
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Quote:
I realise this is caused by the inaccuracies in converting the var to floating point

So there is no mistake, just limit the output to %.3f. If someone does not know why the output is 123456.789063 he will probably search/ ask for it, what will increase his knowledge (about the important fact of inaccuracies of computer maths).
(Sorry for being a smart-ass.)

Last edited by Superku; 01/22/10 15:39.

"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: digits variable inaccuracy? [Re: Superku] #306499
01/22/10 17:00
01/22/10 17:00
Joined: Jan 2004
Posts: 3,023
The Netherlands
Helghast Offline
Expert
Helghast  Offline
Expert

Joined: Jan 2004
Posts: 3,023
The Netherlands
Originally Posted By: Superku
Quote:
I realise this is caused by the inaccuracies in converting the var to floating point

So there is no mistake, just limit the output to %.3f. If someone does not know why the output is 123456.789063 he will probably search/ ask for it, what will increase his knowledge (about the important fact of inaccuracies of computer maths).
(Sorry for being a smart-ass.)


Yes, but then the manual still is wrong in it's example tongue


Formerly known as dennis_fantasy
Portfolio - http://www.designorhea.com/
Project - http://randomchance.cherrygames.org/
Re: digits variable inaccuracy? [Re: Helghast] #306502
01/22/10 17:26
01/22/10 17:26
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Haha ok....... I'm sorry.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: digits variable inaccuracy? [Re: Superku] #306836
01/25/10 10:10
01/25/10 10:10
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Thanks, this must be %.3f - will be fixed.


Moderated by  aztec, Inestical, Matt_Coles, Tobias 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1