Updated to new function syntax

This commit is contained in:
sam-astro 2022-01-05 08:41:25 -05:00 committed by GitHub
parent 83404f266f
commit 1cc2e9abe7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,7 +4,7 @@ float PI = 3.14159265358979
float EulersNumber = 2.71828183
// Trigonometric function Sin
float Sin(float input)
func Sin(input)
{
print input
float out = CPP.Math.Sin(input)
@ -12,42 +12,42 @@ float Sin(float input)
}
// Trigonometric function Cos
float Cos(float input)
func Cos(input)
{
float out = CPP.Math.Cos(input)
return out
}
// Trigonometric function Tan
float Tan(float input)
func Tan(input)
{
float out = CPP.Math.Tan(input)
return out
}
// Sigmoid activation function
float Sigmoid(float input)
func Sigmoid(input)
{
float out = 1 / (1+EulersNumber^-input)
return out
}
// Hyperbolic tangent activation function
float Tanh(float input)
func Tanh(input)
{
float out = ((EulersNumber^input)-(EulersNumber^-input))/((EulersNumber^input)+(EulersNumber^-input))
return out
}
// Rounds input to nearest integer value
float Round(float input)
func Round(input)
{
float out = CPP.Math.Round(input)
return out
}
// Clamps input between min and max
float Clamp(float input, float min, float max)
func Clamp(input, min, max)
{
if input < min
{
@ -61,21 +61,21 @@ float Clamp(float input, float min, float max)
}
// Sets color of pixel to RGB value
float SetPixel(int x, int y, int r, int g, int b)
func SetPixel(x, y, r, g, b)
{
string out = CPP.Graphics.SetPixel(x, y, r, g, b)
return out
}
// Prints input value to console
float Print(string in)
func Print(in)
{
string out = CPP.System.Print(in)
return out
}
// Prints input value to console with appended newline '\n'
float Printl(string in)
func Printl(in)
{
string out = CPP.System.PrintLine(in)
return out