Xengine: more on division by Zero
parent
f09a18a7a8
commit
9d698bcffb
|
@ -2026,6 +2026,18 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
|||
}
|
||||
}
|
||||
|
||||
static public LSLInteger operator %(LSLInteger i1, int i2)
|
||||
{
|
||||
try
|
||||
{
|
||||
return new LSLInteger(i1.value % i2);
|
||||
}
|
||||
catch (DivideByZeroException)
|
||||
{
|
||||
throw new ScriptException("Integer division by Zero");
|
||||
}
|
||||
}
|
||||
|
||||
// static public LSLFloat operator +(LSLInteger i1, double f)
|
||||
// {
|
||||
// return new LSLFloat((double)i1.value + f);
|
||||
|
@ -2084,11 +2096,31 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
|||
return ret;
|
||||
}
|
||||
|
||||
static public LSLInteger operator /(LSLInteger i1, LSLInteger i2)
|
||||
{
|
||||
try
|
||||
{
|
||||
int ret = i1.value / i2.value;
|
||||
return ret;
|
||||
}
|
||||
catch (DivideByZeroException)
|
||||
{
|
||||
throw new ScriptException("Integer division by Zero");
|
||||
}
|
||||
}
|
||||
|
||||
static public LSLInteger operator %(LSLInteger i1, LSLInteger i2)
|
||||
{
|
||||
try
|
||||
{
|
||||
int ret = i1.value % i2.value;
|
||||
return ret;
|
||||
}
|
||||
catch (DivideByZeroException)
|
||||
{
|
||||
throw new ScriptException("Integer division by Zero");
|
||||
}
|
||||
}
|
||||
|
||||
static public LSLInteger operator |(LSLInteger i1, LSLInteger i2)
|
||||
{
|
||||
|
@ -2302,6 +2334,14 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
|||
return new LSLFloat(r);
|
||||
}
|
||||
|
||||
static public LSLFloat operator %(LSLFloat f, int i)
|
||||
{
|
||||
double r = f.value % (double)i;
|
||||
if (IsBadNumber(r))
|
||||
throw new ScriptException("Float division by zero");
|
||||
return new LSLFloat(r);
|
||||
}
|
||||
|
||||
static public LSLFloat operator +(LSLFloat lhs, LSLFloat rhs)
|
||||
{
|
||||
return new LSLFloat(lhs.value + rhs.value);
|
||||
|
@ -2325,6 +2365,14 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
|||
return new LSLFloat(r);
|
||||
}
|
||||
|
||||
static public LSLFloat operator %(LSLFloat lhs, LSLFloat rhs)
|
||||
{
|
||||
double r = lhs.value % rhs.value;
|
||||
if (IsBadNumber(r))
|
||||
throw new ScriptException("Float division by zero");
|
||||
return new LSLFloat(r);
|
||||
}
|
||||
|
||||
static public LSLFloat operator -(LSLFloat f)
|
||||
{
|
||||
return new LSLFloat(-f.value);
|
||||
|
|
Loading…
Reference in New Issue