Published on Jul 7th, 2018, 7/7/18 11:07 am

- 6
- 3
*playlist_add**share*-
*more_horiz*

36

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 |

tracking

4153687

mathematical-functions-datapack

1,165079,329,559826,842002,140820,64651,214207,712893,356071,290694,1030646,15493,171513,336698,476982,98449,817406,209568,526780,928263,1263961,2177557,3,2517345

Join Planet Minecraft!

We're a community of block friendly creatives sharing everything Minecraft! Even if you don't post your own creations, we appreciate feedback on ours. Join us!

Roll Random Mod!

- JJBA Stands DataPack II
*playlist_add*24 diamonds

7,793 views

696 downloads

18 comments

20 favorited**Game Version:**Minecraft 1.13*photo*x 9Mod - Transporter Core DataPack (End-Game Content)
*playlist_add*9 diamonds

3,273 views

209 downloads

1 comments

3 favorited**Game Version:**Minecraft 1.13*videocam**photo*x 3Mod - FMA Alchemy DataPack
*playlist_add*26 diamonds

18,439 views

2,266 downloads

30 comments

27 favorited**Game Version:**Minecraft 1.13*videocam**photo*x 5Mod - Enchanted Book Extractor DataPack (1.14)
*playlist_add*9 diamonds

2,367 views

353 downloads

11 comments

4 favoritedPosted 10/27/2018

by yosho27**Game Version:**Minecraft 1.13*videocam**photo*x 3Mod - Custom NBT Crafting Utility & NEW Crafting Chest
*playlist_add*10 diamonds

5,178 views

0 downloads

8 comments

7 favorited**Game Version:**Minecraft 1.13*photo*x 4Mod

7,628 | People Online |

2,408,626 | Total Members |

2,001,145 | Minecraft Submissions |

1,940,637,294 | Total Submission Views |

361,425,056 | Downloads |

- Qi [Data Pack]
**Game Version:**Minecraft 1.13*photo*x 1Mod - Total Destruction (1.13.x Datapack)
*playlist_add*1 diamonds

256 views

43 downloads

0 comments

0 favorited**Game Version:**Minecraft 1.13*photo*x 5Mod - Wooly Dye [Data Pack]
**Game Version:**Minecraft 1.13*photo*x 1Mod - Team Hardcore DataPack (YOLO)
**Game Version:**Minecraft 1.13*photo*x 1Mod - Timber Datapack
*playlist_add*16 diamonds

12,772 views

4,379 downloads

18 comments

11 favoritedPosted 01/12/2019

by Moggla**Game Version:**Minecraft 1.13*photo*x 1Mod

https://fonts.googleapis.com/css?family=Material+Icons,https://www.planetminecraft.com/css/style-v-version686.css