diff --git a/src/Core/CSMic.Core.csproj b/src/Core/CSMic.Core.csproj
index 7ee23ad..e0b9410 100644
--- a/src/Core/CSMic.Core.csproj
+++ b/src/Core/CSMic.Core.csproj
@@ -7,7 +7,7 @@
enable
False
CSMic.Core
- 2.0.2
+ 2.0.1
CSMic
README.md
latest
diff --git a/src/StandardLibrary/CSMic.StandardLibrary.csproj b/src/StandardLibrary/CSMic.StandardLibrary.csproj
index 0c95a22..639e716 100644
--- a/src/StandardLibrary/CSMic.StandardLibrary.csproj
+++ b/src/StandardLibrary/CSMic.StandardLibrary.csproj
@@ -6,7 +6,7 @@
CSMic.StandardLibrary
enable
enable
- 2.0.2
+ 2.0.1
CSMic.StandardLibrary
README.md
latest
diff --git a/src/StandardLibrary/Functions/Lerp.cs b/src/StandardLibrary/Functions/Lerp.cs
deleted file mode 100644
index 0993d86..0000000
--- a/src/StandardLibrary/Functions/Lerp.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace CSMic.StandardLibrary.Functions
-{
- public class Lerp: FunctionBase, ICodedFunction
- {
- public string Name
- {
- get
- {
- return "lerp";
- }
- }
-
- public override IEnumerable ExpectedArguments
- {
- get
- {
- yield return new FunctionArgument("start", FunctionValue.NUMBER);
- yield return new FunctionArgument("end", FunctionValue.NUMBER);
- yield return new FunctionArgument("ammount", FunctionValue.NUMBER);
- }
- }
-
- public FunctionValue Execute(params FunctionArgument[] args)
- {
- return base.Execute(args, (_args) =>
- {
- var input = _args[0].Value;
- var input2 = _args[1].Value;
- var input3 = _args[2].Value;
-
- decimal start = Convert.ToDecimal(input);
- decimal end = Convert.ToDecimal(input2);
- decimal ammount = Convert.ToDecimal(input3);
-
- if (start == end)
- {
- return new FunctionValue(FunctionValueType.Numeric, start);
- }
-
- var lerp = start + (ammount * (end - start));
-
- return new FunctionValue(FunctionValueType.Numeric, lerp);
- });
- }
- }
-}
diff --git a/src/StandardLibrary/Functions/Log.cs b/src/StandardLibrary/Functions/Log.cs
deleted file mode 100644
index efc2e8a..0000000
--- a/src/StandardLibrary/Functions/Log.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace CSMic.StandardLibrary.Functions
-{
- public class Log: FunctionBase, ICodedFunction
- {
- public string Name
- {
- get
- {
- return "log";
- }
- }
-
- public override IEnumerable ExpectedArguments
- {
- get
- {
- yield return new FunctionArgument("value", FunctionValue.NUMBER);
- yield return new FunctionArgument("base", FunctionValue.NUMBER);
- }
- }
-
- public FunctionValue Execute(params FunctionArgument[] args)
- {
- return base.Execute(args, (_args) =>
- {
- var input = _args[0].Value;
- var input2 = _args[1].Value;
- double number = Convert.ToDouble(input.Value);
- double _baseNumber = Convert.ToDouble(input2.Value);
-
- return new FunctionValue(FunctionValueType.Numeric, Math.Log(number, _baseNumber));
- });
- }
- }
-}
diff --git a/src/StandardLibrary/Functions/Map.cs b/src/StandardLibrary/Functions/Map.cs
deleted file mode 100644
index 665b79f..0000000
--- a/src/StandardLibrary/Functions/Map.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace CSMic.StandardLibrary.Functions
-{
- public class Map: FunctionBase, ICodedFunction
- {
- public string Name
- {
- get
- {
- return "map";
- }
- }
-
- public override IEnumerable ExpectedArguments
- {
- get
- {
- yield return new FunctionArgument("value", FunctionValue.NUMBER);
- yield return new FunctionArgument("oldMinimum", FunctionValue.NUMBER);
- yield return new FunctionArgument("oldMaximum", FunctionValue.NUMBER);
- yield return new FunctionArgument("newMinimum", FunctionValue.NUMBER);
- yield return new FunctionArgument("newMaximum", FunctionValue.NUMBER);
- }
- }
-
- public FunctionValue Execute(params FunctionArgument[] args)
- {
- return base.Execute(args, (_args) =>
- {
- var input = _args[0].Value;
- var input2 = _args[1].Value;
- var input3 = _args[2].Value;
- var input4 = _args[3].Value;
- var input5 = _args[4].Value;
-
- decimal number = Convert.ToDecimal(input);
- decimal oldMinimum = Convert.ToDecimal(input2);
- decimal oldMaximum = Convert.ToDecimal(input3);
- decimal newMinimum = Convert.ToDecimal(input4);
- decimal newMaximum = Convert.ToDecimal(input5);
-
- if (oldMinimum == oldMaximum)
- {
- return FunctionValue.ZERO;
- }
-
- var oldRange = oldMaximum - oldMinimum;
- var newRange = newMaximum - newMinimum;
- var newNumber = newMinimum + ((number - oldMinimum) * (newRange / oldRange));
-
- return new FunctionValue(FunctionValueType.Numeric, newNumber);
- });
- }
- }
-}
diff --git a/src/StandardLibrary/Functions/Natural Log.cs b/src/StandardLibrary/Functions/Natural Log.cs
deleted file mode 100644
index 94252af..0000000
--- a/src/StandardLibrary/Functions/Natural Log.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace CSMic.StandardLibrary.Functions
-{
- public class Natural_Log: FunctionBase, ICodedFunction
- {
- public string Name
- {
- get
- {
- return "ln";
- }
- }
-
- public override IEnumerable ExpectedArguments
- {
- get
- {
- yield return new FunctionArgument("value", FunctionValue.NUMBER);
- }
- }
-
- public FunctionValue Execute(params FunctionArgument[] args)
- {
- return base.Execute(args, (_args) =>
- {
- var input = _args[0].Value;
- double number = Convert.ToDouble(input.Value);
-
- return new FunctionValue(FunctionValueType.Numeric, Math.Log(number));
- });
- }
- }
-}
diff --git a/src/StandardLibrary/Functions/Normalize.cs b/src/StandardLibrary/Functions/Normalize.cs
deleted file mode 100644
index 3a2fc74..0000000
--- a/src/StandardLibrary/Functions/Normalize.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace CSMic.StandardLibrary.Functions
-{
- public class Normalize : FunctionBase, ICodedFunction
- {
- public string Name
- {
- get
- {
- return "normalize";
- }
- }
-
- public override IEnumerable ExpectedArguments
- {
- get
- {
- yield return new FunctionArgument("value", FunctionValue.NUMBER);
- yield return new FunctionArgument("minimum", FunctionValue.NUMBER);
- yield return new FunctionArgument("maximum", FunctionValue.NUMBER);
- }
- }
-
- public FunctionValue Execute(params FunctionArgument[] args)
- {
- return base.Execute(args, (_args) =>
- {
- var input = _args[0].Value;
- var input2 = _args[1].Value;
- var input3 = _args[2].Value;
-
- decimal number = Convert.ToDecimal(input);
- decimal minimum = Convert.ToDecimal(input2);
- decimal maximum = Convert.ToDecimal(input3);
-
- if (minimum == maximum)
- {
- return FunctionValue.ZERO;
- }
-
- var normalization = (number - minimum) / (maximum - minimum);
-
- return new FunctionValue(FunctionValueType.Numeric, normalization);
- });
- }
- }
-}
diff --git a/src/StandardLibrary/Functions/NumberTheory/GreatedCommonDenomitator.cs b/src/StandardLibrary/Functions/NumberTheory/GreatedCommonDenomitator.cs
index 980da00..234022d 100644
--- a/src/StandardLibrary/Functions/NumberTheory/GreatedCommonDenomitator.cs
+++ b/src/StandardLibrary/Functions/NumberTheory/GreatedCommonDenomitator.cs
@@ -58,7 +58,7 @@ namespace CSMic.StandardLibrary.Functions.NumberTheory
decimal first = Convert.ToDecimal(inputFirst.Value);
decimal second = Convert.ToDecimal(inputSecond.Value);
- if (first <= 0 && second <= 0)
+ if (first <= 0 || second <= 0)
{
return FunctionValue.ZERO;
}
diff --git a/src/StandardLibrary/Functions/Power.cs b/src/StandardLibrary/Functions/Power.cs
deleted file mode 100644
index a6dcd37..0000000
--- a/src/StandardLibrary/Functions/Power.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace CSMic.StandardLibrary.Functions
-{
- public class Power : FunctionBase, ICodedFunction
- {
- public string Name
- {
- get
- {
- return "pow";
- }
- }
-
- public override IEnumerable ExpectedArguments
- {
- get
- {
- yield return new FunctionArgument("base", FunctionValue.NUMBER);
- yield return new FunctionArgument("exponent", FunctionValue.NUMBER);
- }
- }
-
- public FunctionValue Execute(params FunctionArgument[] args)
- {
- return base.Execute(args, (_args) =>
- {
- var input = _args[0].Value;
- var input2 = _args[1].Value;
- double _base = Convert.ToDouble(input.Value);
- double exponent = Convert.ToDouble(input2.Value);
-
- return new FunctionValue(FunctionValueType.Numeric, Math.Pow(_base, exponent));
- });
- }
- }
-}
diff --git a/src/StandardLibrary/Functions/SmoothStep.cs b/src/StandardLibrary/Functions/SmoothStep.cs
deleted file mode 100644
index b375d63..0000000
--- a/src/StandardLibrary/Functions/SmoothStep.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace CSMic.StandardLibrary.Functions
-{
- public class SmoothStep : FunctionBase, ICodedFunction
- {
- public string Name
- {
- get
- {
- return "lerp";
- }
- }
-
- public override IEnumerable ExpectedArguments
- {
- get
- {
- yield return new FunctionArgument("startEdge", FunctionValue.NUMBER);
- yield return new FunctionArgument("endEdge", FunctionValue.NUMBER);
- yield return new FunctionArgument("value", FunctionValue.NUMBER);
- }
- }
-
- public FunctionValue Execute(params FunctionArgument[] args)
- {
- return base.Execute(args, (_args) =>
- {
- var input = _args[0].Value;
- var input2 = _args[1].Value;
- var input3 = _args[2].Value;
-
- decimal startEdge = Convert.ToDecimal(input);
- decimal endEdge = Convert.ToDecimal(input2);
- decimal value = Convert.ToDecimal(input3);
-
- var normalization = Math.Clamp((value - startEdge) / (endEdge - startEdge), 0, 1);
- var polynomialization = normalization * normalization * (3 - (2 * normalization));
-
- return new FunctionValue(FunctionValueType.Numeric, polynomialization);
- });
- }
- }
-}
diff --git a/src/StandardLibrary/Functions/SquareRoot.cs b/src/StandardLibrary/Functions/SquareRoot.cs
deleted file mode 100644
index d6e25fd..0000000
--- a/src/StandardLibrary/Functions/SquareRoot.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace CSMic.StandardLibrary.Functions
-{
- public class SquareRoot: FunctionBase, ICodedFunction
- {
- public string Name
- {
- get
- {
- return "sqrt";
- }
- }
-
- public override IEnumerable ExpectedArguments
- {
- get
- {
- yield return new FunctionArgument("value", FunctionValue.NUMBER);
- }
- }
-
- public FunctionValue Execute(params FunctionArgument[] args)
- {
- return base.Execute(args, (_args) =>
- {
- var input = _args[0].Value;
- double number = Convert.ToDouble(input.Value);
-
- return new FunctionValue(FunctionValueType.Numeric, Math.Sqrt(number));
- });
- }
- }
-}
diff --git a/src/StandardLibrary/Initializer.cs b/src/StandardLibrary/Initializer.cs
index 5cc5970..02d0f7b 100644
--- a/src/StandardLibrary/Initializer.cs
+++ b/src/StandardLibrary/Initializer.cs
@@ -64,7 +64,6 @@ namespace CSMic.StandardLibrary
inputInterpreter.RegisterFunction(new Sign());
inputInterpreter.RegisterFunction(new Min());
inputInterpreter.RegisterFunction(new Max());
- inputInterpreter.RegisterFunction(new SquareRoot());
}
/// Initializes the angle-related functions.
@@ -178,7 +177,7 @@ namespace CSMic.StandardLibrary
inputInterpreter.Interpret("tau :: 6.2831853071795862");
inputInterpreter.Interpret("phi :: 1.6180339887498948");
inputInterpreter.Interpret("goldenratio :: 1.6180339887498948");
- inputInterpreter.Interpret("euler :: 0.5772156649015329");
+ inputInterpreter.Interpret("eurler :: 0.5772156649015329");
inputInterpreter.Interpret("omega :: 0.5671432904097839");
}
}
diff --git a/src/Tests/NumberTheoryFunctionsTests.cs b/src/Tests/NumberTheoryFunctionsTests.cs
index dda332f..e4c09b4 100644
--- a/src/Tests/NumberTheoryFunctionsTests.cs
+++ b/src/Tests/NumberTheoryFunctionsTests.cs
@@ -34,7 +34,7 @@ public class NumberTheoryFunctionsTests
{
AssertSuccess(_interp.Interpret("gcd(54, 24)"), 6m, _interp);
AssertSuccess(_interp.Interpret("gcd(7, 3)"), 1m, _interp);
- AssertSuccess(_interp.Interpret("gcd(0, 5)"), 5m, _interp);
+ AssertSuccess(_interp.Interpret("gcd(0, 5)"), 0m, _interp);
AssertSuccess(_interp.Interpret("gcd(5.5, 2)"), 0m, _interp);
}
diff --git a/src/Tests/StdlibFunctionsTests.cs b/src/Tests/StdlibFunctionsTests.cs
index f921f68..263795e 100644
--- a/src/Tests/StdlibFunctionsTests.cs
+++ b/src/Tests/StdlibFunctionsTests.cs
@@ -90,14 +90,6 @@ public class StdlibFunctionsTests
AssertSuccess(result, expected, _interp);
}
- [TestCase("sqrt(25)", 5)]
- [TestCase("sqrt(1)", 1)]
- public void Sqrt_Works(string expr, decimal expected)
- {
- var result = _interp.Interpret(expr);
- AssertSuccess(result, expected, _interp);
- }
-
[TestCase("pi", "3.1415926535897931")]
[TestCase("e", "2.7182818284590451")]
[TestCase("tau", "6.2831853071795862")]