Added method for obtaining the sign of a value.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1832 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-10-26 20:31:06 +00:00
parent fec48b8586
commit 868ce6f471
@@ -1,5 +1,5 @@
//
// $Id: MathUtil.java,v 1.5 2002/09/17 04:00:09 mdb Exp $
// $Id: MathUtil.java,v 1.6 2002/10/26 20:31:06 mdb Exp $
package com.threerings.media.util;
@@ -56,4 +56,13 @@ public class MathUtil
{
return Math.PI * (3*a + 3*b - Math.sqrt((a + 3*b) * (b + 3*a)));
}
/**
* Returns positive 1 if the sign of the argument is positive, or -1
* if the sign of the argument is negative.
*/
public static int sign (int value)
{
return (value == 0) ? 1 : value/value;
}
}