Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
"Round down"
#7
What programming language are you using for this? I was going to guess Java, but the "function floor0(number)" syntax made me think otherwise. If it's Java, I can help you with classes. If not, I probably won't know the proper syntax. I can, however, go over the idea behind it. What I'm assuming Fiel had in mind was to make a class that will substitute for whatever type of variable you're using for number (I'm assuming an int or a float). The class will itself contain an int and a float as instance variables and will have getter/setter methods for them (e.g. class.getInt() and class.getFloat(), which will return the appropriate stored value). You could (and would probably want to) make other methods as well, such as class.add(), class.subtract(), class.multiply(), and class.divide() that perform the appropriate operation on both versions of the number (the int and the float) and then round the int. This way you'll be able to get at the unrounded float at any time, and the int should automatically round after every operation. The only real drawback is that you can't just use +, -, *, and / to do operations with it. But yeah, if you tell me what language you're using I might be able to be more specific with my help.
Reply


Messages In This Thread
"Round down" - by RADRaze2KX - 2010-08-24, 04:23 PM
"Round down" - by Hazzy - 2010-08-24, 04:31 PM
"Round down" - by Fiel - 2010-08-24, 05:47 PM
"Round down" - by RADRaze2KX - 2010-08-24, 06:00 PM
"Round down" - by Fiel - 2010-08-24, 06:36 PM
"Round down" - by RADRaze2KX - 2010-08-24, 09:42 PM
"Round down" - by Lord Xela - 2010-08-24, 10:30 PM
"Round down" - by Fiel - 2010-08-24, 10:49 PM
"Round down" - by RADRaze2KX - 2010-08-25, 04:18 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)