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: Anyone else hate decimals?

Previous Thread :: Next Thread 
whupdup is not online. whupdup
Joined: 18 Aug 2012
Total Posts: 122
09 Nov 2013 08:53 PM
Cause I sure do.
Le integer casting function:

function int(num)
local inum,idec = math.modf(num)
if idec >= 0.5 then
return inum + 1;
else
return inum;
end
end
Report Abuse
18cwatford is not online. 18cwatford
Joined: 08 Oct 2009
Total Posts: 5410
09 Nov 2013 08:57 PM
function int(n) return math[(n % 1 >= 0.5 and 'ceil' or 'floor')](n) end

There.
Report Abuse
chickenman158 is not online. chickenman158
Joined: 18 Jan 2011
Total Posts: 915
09 Nov 2013 09:08 PM
What, would you rather use integers when you should use decimals? Would you rather hack together every floating-point value as DWORD (32 bits. Who needs size_t anyway? Micro$oft $upremacy. //:■( ) because your language doesn't support floats?
Also, you don't need to round. You should probably just go math.ceil().
Report Abuse
whupdup is not online. whupdup
Joined: 18 Aug 2012
Total Posts: 122
09 Nov 2013 09:20 PM
But when you output numbers like angles and it gives you like 27.55675665435645 so eat my shorts.
Report Abuse
whupdup is not online. whupdup
Joined: 18 Aug 2012
Total Posts: 122
09 Nov 2013 09:36 PM
Heh, get it? Shorts? Whatever.

Anyway, float your floating-points over somewhere else.
Report Abuse
XAXA is not online. XAXA
Joined: 10 Aug 2008
Total Posts: 6315
10 Nov 2013 03:00 AM
I like decimals.

Don't discriminate.
Report Abuse
OneTrueGodTheHolyCow is not online. OneTrueGodTheHolyCow
Joined: 24 Oct 2013
Total Posts: 9350
10 Nov 2013 03:25 AM
whatever floats your float.
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
10 Nov 2013 12:08 PM
"function int(n) return math[(n % 1 >= 0.5 and 'ceil' or 'floor')](n) end"

Ugly.

function int(n) return math.floor(n+0.5) end
Report Abuse
Dr01d3k4 is not online. Dr01d3k4
Joined: 11 Oct 2007
Total Posts: 17916
10 Nov 2013 12:19 PM
y u no ("%.0f"):format(n)
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
10 Nov 2013 12:30 PM
dr01d: dat no round tho
Report Abuse
Dr01d3k4 is not online. Dr01d3k4
Joined: 11 Oct 2007
Total Posts: 17916
10 Nov 2013 12:31 PM
It does, I tried it.
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
10 Nov 2013 12:36 PM
dr01d: oh kool
Report Abuse
Oysi is not online. Oysi
Joined: 06 Jul 2009
Total Posts: 9058
10 Nov 2013 12:52 PM
[ Content Deleted ]
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
10 Nov 2013 12:54 PM
oysi: good point, but doesn't % call math.fmod() internally, therefore making your method slower than mine?
Report Abuse
OneTrueGodTheHolyCow is not online. OneTrueGodTheHolyCow
Joined: 24 Oct 2013
Total Posts: 9350
10 Nov 2013 02:02 PM
@digpoe,

.....u would have to see what math.floor does before you can assume that.

but anyhow who cares its probably only a few microseconds difference
Report Abuse
Cryptize is not online. Cryptize
Joined: 01 Oct 2010
Total Posts: 949
10 Nov 2013 02:26 PM
Decimals give me the power to break things up more precisely... So no I like decimals.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
10 Nov 2013 02:31 PM
Decimals are w/e, unless it's like
5.000000000000001 stupid flooats
Report Abuse
AndroidKitKat is not online. AndroidKitKat
Joined: 21 Sep 2013
Total Posts: 1525
14 Nov 2013 08:08 AM
-sigh- no offense to the others, but that's not integer casting, that's rounding. Integer casting is getting the floor.

EOS db 0x00 ;End of String Marker
Report Abuse
TheLuaWeaver is not online. TheLuaWeaver
Joined: 09 Feb 2010
Total Posts: 1504
14 Nov 2013 06:38 PM
>whatever floats your float.
Actually, whatever ints your float.
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