generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: This is just uncool.

Previous Thread :: Next Thread 
ArceusInator is not online. ArceusInator
Joined: 10 Oct 2009
Total Posts: 30553
28 Mar 2013 11:10 PM
for n=1,3,0.1 do print(n, 2-n, 2-n==0.1) end

>1.9 0.099999999999999 false

wat up wit dat
Report Abuse
xSIXx is not online. xSIXx
Joined: 06 Aug 2010
Total Posts: 9202
28 Mar 2013 11:12 PM
function round(num, r)
return math.floor(num/r+.5)*r
end

round(num, 0.1 or however accurate you are intervalling)
Report Abuse
Anaminus is not online. Anaminus
Top 100 Poster
Joined: 29 Nov 2006
Total Posts: 5945
28 Mar 2013 11:14 PM
Floatin points, man. If you don't like it, do dis:

for n=10,30,1 do print(n/10) end
Report Abuse
ArceusInator is not online. ArceusInator
Joined: 10 Oct 2009
Total Posts: 30553
28 Mar 2013 11:20 PM
Now I'm going to be paranoid about operating on decimals for the next two months. Thanks, roblox.
Report Abuse
kingkiller1000 is not online. kingkiller1000
Joined: 12 Dec 2008
Total Posts: 26415
28 Mar 2013 11:22 PM
Technology Lesson 1: Computers are very bad with decimals.
Report Abuse
yt85tyg5gfy6yy8 is not online. yt85tyg5gfy6yy8
Joined: 02 Feb 2013
Total Posts: 417
29 Mar 2013 02:14 AM
why this uncool??
Report Abuse
yt85tyg5gfy6yy8 is not online. yt85tyg5gfy6yy8
Joined: 02 Feb 2013
Total Posts: 417
29 Mar 2013 02:14 AM
why?
Report Abuse
Radioaktiivinen is not online. Radioaktiivinen
Joined: 25 Apr 2009
Total Posts: 18629
29 Mar 2013 06:15 AM
You shud move on to use values representable in binary :3
Report Abuse
SN0X is not online. SN0X
Joined: 24 Oct 2011
Total Posts: 7277
29 Mar 2013 07:02 AM
just do math with strings when ur doing stuff like that
Report Abuse
Prehistoricman is not online. Prehistoricman
Joined: 20 Sep 2008
Total Posts: 12490
29 Mar 2013 07:42 AM
'Thanks, roblox.'

Blame Lua, not Roblox.
Report Abuse
TheMyrco is not online. TheMyrco
Joined: 13 Aug 2011
Total Posts: 15105
29 Mar 2013 08:22 AM
http://www.exploringbinary.com /double-rounding-errors-in-floating-point-conversions/
Report Abuse
Validar is not online. Validar
Joined: 15 Mar 2013
Total Posts: 276
29 Mar 2013 10:16 AM
@pre
>Lua
>RBX.Lua
Blame ROBLOX for editing off of Lua.
Report Abuse
Prehistoricman is not online. Prehistoricman
Joined: 20 Sep 2008
Total Posts: 12490
29 Mar 2013 10:33 AM
RBX.Lua is an environment and Roblox have not adapted Lua except removing the ability to load bytecode through loadstring. It is not the fault of Roblox, at all.
Report Abuse
kingkiller1000 is not online. kingkiller1000
Joined: 12 Dec 2008
Total Posts: 26415
29 Mar 2013 10:40 AM
Here's something I found that you guys might find interesting:

"Interestingly, the launch failure of the Ariane 5 rocket, which exploded 37 seconds after liftoff on June 4, 1996, occurred because of a software error that resulted from converting a 64-bit floating point number to a 16-bit integer. The value of the floating point number happened to be larger than could be represented by a 16-bit integer. The overflow wasn't handled properly, and in response, the computer cleared its memory. The memory dump was interpreted by the rocket as instructions to its rocket nozzles, and an explosion resulted."
Report Abuse
Waffle3z is not online. Waffle3z
Joined: 15 Apr 2011
Total Posts: 266
29 Mar 2013 10:41 AM
This is also annoying in GUIs. I set its position to 2.5, stop changing it to 2.49999997
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
29 Mar 2013 12:05 PM
That's just Lua's floating point precision. 2.5 isn't 2.5 to the computer; it's either 2.49999997 or 2.50000001.
Report Abuse
RenderSettings is not online. RenderSettings
Joined: 16 Aug 2010
Total Posts: 2560
29 Mar 2013 12:06 PM
king: Which is why we have build tests and debugging and srsly should of NASA noticed that
Report Abuse
Prehistoricman is not online. Prehistoricman
Joined: 20 Sep 2008
Total Posts: 12490
29 Mar 2013 12:07 PM
I believe the GUI thing is the Scale automatically going to the nearest pixel.
Report Abuse
kingkiller1000 is not online. kingkiller1000
Joined: 12 Dec 2008
Total Posts: 26415
29 Mar 2013 12:07 PM
2.5 should be solid though. In binary it's written as 10.1
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
29 Mar 2013 12:10 PM
I know. But it's just how the creator of Lua decided how it was to be. It could also be the C++ base behind Lua, but I don't code in C++ so I don't know that much.
Report Abuse
lombardo2 is not online. lombardo2
Joined: 30 Nov 2008
Total Posts: 1604
29 Mar 2013 12:23 PM
In python docs there's an article called "Floating Point Arithmetic: Issues and Limitations". You should read it, also, why has nobody written an article about this in the roblox wiki?
Report Abuse
lombardo2 is not online. lombardo2
Joined: 30 Nov 2008
Total Posts: 1604
29 Mar 2013 12:26 PM
@digpoe: That's not lua, that's the IEEE Standard 754, unless you interpret the exponent as base 10, you are going to get this rounding errors.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image