cs-mic/src/StandardLibrary/Functions/Angle/Radians.cs
codex 5f7b862d5e Fix .NET Standard compatibility:
- Replace double.DegreesToRadians/RadiansToDegrees with Math-based conversions
- Replace Random.Shared with thread-local Random for thread safety
2025-08-26 00:39:43 -05:00

34 lines
923 B
C#

namespace CSMic.StandardLibrary.Functions.Angle
{
public class Radians : FunctionBase, ICodedFunction
{
public string Name
{
get
{
return "radians";
}
}
public override IEnumerable<FunctionArgument> ExpectedArguments
{
get
{
yield return new FunctionArgument("value", FunctionValue.NUMBER);
}
}
public FunctionValue Execute(params FunctionArgument[] args)
{
return Execute(args, (_args) =>
{
var input = _args[0].Value;
decimal value = Convert.ToDecimal(input.Value);
// Convert degrees to radians (compatible with .NET Standard)
return new FunctionValue(FunctionValueType.Numeric, (double)value * (Math.PI / 180.0));
});
}
}
}