Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Valfloat("92.14") = 92.139999?

Author
Message
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 21st Jan 2018 00:03
Is this just par for the course as far as floats are concerned or is it an issue?
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 21st Jan 2018 00:18 Edited at: 21st Jan 2018 00:28
its about how floats are saved in memory. other languages have decimal or currency data type.
print(str(ValFloat("92.14"),2))

https://en.wikipedia.org/wiki/Single-precision_floating-point_format
AGK (Steam) V2017.12.12 : Windows 10 Pro 64 Bit : AMD (17.12.1) Radeon R7 265 : Mac mini OS High Sierra (10.13)
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 21st Jan 2018 02:26
Neat! I didn't know you could do with with str()
Thanks for the link too
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 23rd Jan 2018 20:26
I SO wish we had a high accuracy maths lib for AGK. Lots of niche calculator apps we could make.
Cybermind
Valued Member
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 24th Jan 2018 09:23
Here is a little in-depth information on floats and precision.

http://www.learncpp.com/cpp-tutorial/25-floating-point-numbers/
13/0
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 24th Jan 2018 13:55
A few days ago, a company claims to have solved floating point precision for processors, in case anyone was curious.
https://science.slashdot.org/story/18/01/21/0157230/has-the-decades-old-floating-point-error-problem-been-solved
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds

Login to post a reply

Server time is: 2024-04-23 08:43:24
Your offset time is: 2024-04-23 08:43:24