Math.tau as a builtin constant (2 * math.pi)

Just want to point out that these points made in the comments of the pull request are very good points from my perspective.

4 Likes

Erm. I’m really not sure if language features that are able to be done super simply as a one liner are really worth it.

There are many super small additions that could in theory be added but if we took this policy as a general rule then in practice everything would become super bloated.

The use cases that need this could just do

local tau = math.pi * 2

or just type

math.pi*2
1 Like

unfortunately, the pull request was declined, someone named @metatablecatmaid said some weird points…

I’m on board the tau train
Every time I need it, I try to use it and find out it doesn’t exist. :frowning_face:
try, get sad, forget, repeat

1 Like

[content flagged]

what if roblox added ‘math.wrap()’, other noises and ‘math.mcm’ (minimum common multiple) [there was one more but i forgot]

This would still be nice to have. The API works about exclusively in radians; it’s more intuitive for developers to be thinking in terms of the circle radius.

I should note that justifying this API addition would not be unprecedented either. Consider the Vector3 API, which now features Vector3.one, Vector3.zero, Vector3.xAxis, Vector3.yAxis, and Vector3.zAxis. Historically, it would have been trivial to define these at the start of the script; yet in practice, very few scripters did. Why? Because it plainly would have been a mild inconvenience. It was only after the addition of these constants, that recycling these quantities became more idiomatic. The addition of tau to the math library, would likewise promote good scripting practices, by solving the need for developers to multiply runtime expressions by 2–an operation which depending on evaluation order, may unwittingly necessitate the otherwise avoidable allocation of comparably expensive immutable datatypes.

2 Likes