Z-Sharp/Slang/builtin.slg
sam-astro 9874d03b3f Added many built-in functions and variables, also allowed for displaying graphics.
Graphics are currently *very* slow, and that is due to my underlying code. I will need to spend the next week or so just optimizing.
2022-01-02 15:33:17 -05:00

58 lines
874 B
Plaintext

float PI = 3.14159265358979
float EulersNumber = 2.71828183
float Sin(float input)
{
float out = CPP.Math.Sin(input)
return out
}
float Cos(float input)
{
float out = CPP.Math.Cos(input)
return out
}
float Tan(float input)
{
float out = CPP.Math.Tan(input)
return out
}
float Sigmoid(float input)
{
float out = 1 / (1+EulersNumber^-input)
return out
}
float Tanh(float input)
{
float out = ((EulersNumber^input)-(EulersNumber^-input))/((EulersNumber^input)+(EulersNumber^-input))
return out
}
float Round(float input)
{
float out = CPP.Math.Round(input)
return out
}
float Clamp(float input, float min, float max)
{
if input < min
{
return min
}
if input > max
{
return max
}
return input
}
// Sets color of pixel to RGB value
float SetPixel(int x, int y, int r, int g, int b)
{
string out = CPP.Graphics.SetPixel(x, y, r, g, b)
return out
}