diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs
index 7ac7a651ff..d5211f5107 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs
@@ -1511,6 +1511,26 @@ namespace OpenSim.Region.ScriptEngine.Common
return new LSLFloat(f.value / (double)i);
}
+ static public LSLFloat operator +(LSLFloat lhs, LSLFloat rhs)
+ {
+ return new LSLFloat(lhs.value + rhs.value);
+ }
+
+ static public LSLFloat operator -(LSLFloat lhs, LSLFloat rhs)
+ {
+ return new LSLFloat(lhs.value - rhs.value);
+ }
+
+ static public LSLFloat operator *(LSLFloat lhs, LSLFloat rhs)
+ {
+ return new LSLFloat(lhs.value * rhs.value);
+ }
+
+ static public LSLFloat operator /(LSLFloat lhs, LSLFloat rhs)
+ {
+ return new LSLFloat(lhs.value / rhs.value);
+ }
+
static public LSLFloat operator -(LSLFloat f)
{
return new LSLFloat(-f.value);
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index 7eb5e77af7..77bb426999 100644
--- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -1579,6 +1579,26 @@ namespace OpenSim.Region.ScriptEngine.Shared
return new LSLFloat(f.value / (double)i);
}
+ static public LSLFloat operator +(LSLFloat lhs, LSLFloat rhs)
+ {
+ return new LSLFloat(lhs.value + rhs.value);
+ }
+
+ static public LSLFloat operator -(LSLFloat lhs, LSLFloat rhs)
+ {
+ return new LSLFloat(lhs.value - rhs.value);
+ }
+
+ static public LSLFloat operator *(LSLFloat lhs, LSLFloat rhs)
+ {
+ return new LSLFloat(lhs.value * rhs.value);
+ }
+
+ static public LSLFloat operator /(LSLFloat lhs, LSLFloat rhs)
+ {
+ return new LSLFloat(lhs.value / rhs.value);
+ }
+
static public LSLFloat operator -(LSLFloat f)
{
return new LSLFloat(-f.value);
diff --git a/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestLSLFloat.cs b/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestLSLFloat.cs
index 2d553a7ac4..2a2603186b 100644
--- a/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestLSLFloat.cs
+++ b/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestLSLFloat.cs
@@ -496,5 +496,68 @@ namespace OpenSim.Region.ScriptEngine.Common.Tests
Assert.AreEqual(number.Value, testFloat.ToString());
}
}
+
+ ///
+ /// Tests addition of two LSLFloats.
+ ///
+ [Test]
+ public void TestAddTwoLSLFloats()
+ {
+ LSL_Types.LSLFloat testResult;
+
+ foreach (KeyValuePair number in m_doubleDoubleSet)
+ {
+ testResult = new LSL_Types.LSLFloat(number.Key) + new LSL_Types.LSLFloat(number.Value);
+ Assert.That(testResult.value, new DoubleToleranceConstraint(number.Key + number.Value, _lowPrecisionTolerance));
+ }
+ }
+
+ ///
+ /// Tests subtraction of two LSLFloats.
+ ///
+ [Test]
+ public void TestSubtractTwoLSLFloats()
+ {
+ LSL_Types.LSLFloat testResult;
+
+ foreach (KeyValuePair number in m_doubleDoubleSet)
+ {
+ testResult = new LSL_Types.LSLFloat(number.Key) - new LSL_Types.LSLFloat(number.Value);
+ Assert.That(testResult.value, new DoubleToleranceConstraint(number.Key - number.Value, _lowPrecisionTolerance));
+ }
+ }
+
+ ///
+ /// Tests multiplication of two LSLFloats.
+ ///
+ [Test]
+ public void TestMultiplyTwoLSLFloats()
+ {
+ LSL_Types.LSLFloat testResult;
+
+ foreach (KeyValuePair number in m_doubleDoubleSet)
+ {
+ testResult = new LSL_Types.LSLFloat(number.Key) * new LSL_Types.LSLFloat(number.Value);
+ Assert.That(testResult.value, new DoubleToleranceConstraint(number.Key * number.Value, _lowPrecisionTolerance));
+ }
+ }
+
+ ///
+ /// Tests division of two LSLFloats.
+ ///
+ [Test]
+ public void TestDivideTwoLSLFloats()
+ {
+ LSL_Types.LSLFloat testResult;
+
+ foreach (KeyValuePair number in m_doubleDoubleSet)
+ {
+ if (number.Value != 0.0) // Let's avoid divide by zero.
+ {
+ testResult = new LSL_Types.LSLFloat(number.Key) / new LSL_Types.LSLFloat(number.Value);
+ Assert.That(testResult.value, new DoubleToleranceConstraint(number.Key / number.Value, _lowPrecisionTolerance));
+ }
+ }
+ }
}
}