Published Jul 7th, 2018, 7/7/18 11:07 am
- 7,846 views, 4 today
- 313 downloads, 0 today
63
Mathematical Functions Datapack by yosho27
Version 0.1.3
Includes sine, cosine, tangent, absolute value, exponent, square root, and random
This was designed to be like the Math import in Java or Python, but for datapacks
Feel free to use this with your datapacks; if you use it credit would be appreciated
To use the functions, set the "math_in" and other input variables, call the function, and then get the "math_out" variable
function math:sin
"math_in" is an angle in degrees; "math_out" will be the sine of the angle scaled up by 100
function math:cos
"math_in" is an angle in degrees; "math_out" will be the cosine of the angle scaled up by 100
function math:tan
"math_in" is an angle in degrees; "math_out" will be the tangent of the angle scaled up by 100
function math:abs
"math_in" is a number; "math_out" will be the absolute value of the number
function math:pow
"math_in" is a base; "math_exp" is an exponent; "math_out" will be the base to the power of the exponent
function math:sqrt
"math_in" is a number; "math_out" will be the absolute value of the number scaled up by 100
function math:rand (Contributed by Mcskware using using the random0 LCG)
"math_maxrand" is a maximum value; "math_out" will be a psuedo-random number from 0 to the maximum value, inclusive
because scoreboard variables have to be integers, all input and output values are integers
sin, cos, tan, and sqrt output values are scaled up by 100 to allow 2 extra decimal places of precision
sin, cos, and tan are approximations, and have an average error of about 0.04 (so an average error of about 4 for the scaled up value)
input values are preserved by all functions
Thanks to Mcskware for contributing the PRNG!
Version 0.1.3
Includes sine, cosine, tangent, absolute value, exponent, square root, and random
This was designed to be like the Math import in Java or Python, but for datapacks
Feel free to use this with your datapacks; if you use it credit would be appreciated
To use the functions, set the "math_in" and other input variables, call the function, and then get the "math_out" variable
function math:sin
"math_in" is an angle in degrees; "math_out" will be the sine of the angle scaled up by 100
function math:cos
"math_in" is an angle in degrees; "math_out" will be the cosine of the angle scaled up by 100
function math:tan
"math_in" is an angle in degrees; "math_out" will be the tangent of the angle scaled up by 100
function math:abs
"math_in" is a number; "math_out" will be the absolute value of the number
function math:pow
"math_in" is a base; "math_exp" is an exponent; "math_out" will be the base to the power of the exponent
function math:sqrt
"math_in" is a number; "math_out" will be the absolute value of the number scaled up by 100
function math:rand (Contributed by Mcskware using using the random0 LCG)
"math_maxrand" is a maximum value; "math_out" will be a psuedo-random number from 0 to the maximum value, inclusive
because scoreboard variables have to be integers, all input and output values are integers
sin, cos, tan, and sqrt output values are scaled up by 100 to allow 2 extra decimal places of precision
sin, cos, and tan are approximations, and have an average error of about 0.04 (so an average error of about 4 for the scaled up value)
input values are preserved by all functions
Thanks to Mcskware for contributing the PRNG!
Credit | Mcskware for the PRNG |
Progress | 100% complete |
Game Version | Minecraft 1.13 |
Tags |
tools/tracking
4153687
7
mathematical-functions-datapack
Create an account or sign in to comment.
For smaller numbers it works great.