• Welcome to Valhalla Legends Archive.
 

My rounding function. Need constructive criticism please.

Started by Sorc.Polgara, November 21, 2005, 02:09 PM

Previous topic - Next topic

Warrior

Quote from: effect on March 09, 2006, 11:52 PM
Islam is a steaming pile of fucking dog shit. Everything about it is flawed, anybody who believes in it is a terrorist, if you disagree with me, then im sorry your wrong.

Quote from: Rule on May 07, 2006, 01:30 PM
Why don't you stop being American and start acting like a decent human?

iago

Quote from: Yoni on November 26, 2005, 08:26 PM
The opposite of the floor function is called the ceiling function. The function iago forgot the name of is probably something like Math.ceil.
I was looking for the one half way between floor and ceiling, actually.  Like, maybe chest level.  "round"
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Joe[x86]

Quote from: brew on April 25, 2007, 07:33 PM
that made me feel like a total idiot. this entire thing was useless.

iago

Quote from: Joe on November 28, 2005, 07:02 AM
(Math.floor(i) + Math.ceil(i)) / 2

Chest level.

If you're planning to use that as an integer, then it will return the same result as Math.floor(i);
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Joe[x86]

Oh, that's true..

public static double chestLevel(double d) {
  // Double D, haha. I didn't realize that it had such an ambiguous meaning until I typed it. It's staying!
  return (Math.floor(i) + Math.ceil(i)) / 2;
}


And is Ceiling really a math function, or was Yoni just being humorus? This may sound kinda stupid, but I found that pretty funny. Of course, I found "Fibonacci" to be funny too.

EDIT -
I spent too much time with VB today (an hour, class time). I forgot my semicolon! Pheer.
Quote from: brew on April 25, 2007, 07:33 PM
that made me feel like a total idiot. this entire thing was useless.

iago

Quote from: Joe on November 28, 2005, 05:50 PM
Oh, that's true..

public static double chestLevel(double d) {
  // Double D, haha. I didn't realize that it had such an ambiguous meaning until I typed it. It's staying!
  return (Math.floor(i) + Math.ceil(i)) / 2;
}


And is Ceiling really a math function, or was Yoni just being humorus? This may sound kinda stupid, but I found that pretty funny. Of course, I found "Fibonacci" to be funny too.

EDIT -
I spent too much time with VB today (an hour, class time). I forgot my semicolon! Pheer.

yes, ceil is a real function, and yes, it's the opposite of floor.  It's around in most real languages that I'm aware of. 
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Yoni

Quote from: iago on November 28, 2005, 06:12 PM
Quote from: Joe on November 28, 2005, 05:50 PM
Oh, that's true..

public static double chestLevel(double d) {
// Double D, haha. I didn't realize that it had such an ambiguous meaning until I typed it. It's staying!
return (Math.floor(i) + Math.ceil(i)) / 2;
}


And is Ceiling really a math function, or was Yoni just being humorus? This may sound kinda stupid, but I found that pretty funny. Of course, I found "Fibonacci" to be funny too.

EDIT -
I spent too much time with VB today (an hour, class time). I forgot my semicolon! Pheer.

yes, ceil is a real function, and yes, it's the opposite of floor. It's around in most real languages that I'm aware of.

Not just programming languages; it's a common notation in mathematics as well.
http://mathworld.wolfram.com/FloorFunction.html
http://mathworld.wolfram.com/CeilingFunction.html

A short list of things that aren't funny:
1. "ceiling function"
2. "Fibonacci" (listen man, that's a mathematician's last name. Do I say "Joe" is funny?)
3. "double d"

iago

This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Yoni


Warrior

Quote from: effect on March 09, 2006, 11:52 PM
Islam is a steaming pile of fucking dog shit. Everything about it is flawed, anybody who believes in it is a terrorist, if you disagree with me, then im sorry your wrong.

Quote from: Rule on May 07, 2006, 01:30 PM
Why don't you stop being American and start acting like a decent human?


Joe[x86]

Quote2. "Fibonacci" (listen man, that's a mathematician's last name. Do I say "Joe" is funny?)

No, but a bunch of people say that LaFrance is funny. =/.
Quote from: brew on April 25, 2007, 07:33 PM
that made me feel like a total idiot. this entire thing was useless.

rabbit

Grif: Yeah, and the people in the red states are mad because the people in the blue states are mean to them and want them to pay money for roads and schools instead of cool things like NASCAR and shotguns.  Also, there's something about ketchup in there.