I would like to propose an addition to the Math namespace in future JavaScript versions, is this the right place?

Yes. That doesn't affect anything I've said - despite Python shipping tau as a constant for years, it continues to be the case that many fewer people know what tau means than pi.

it continues to be the case that many fewer people know what tau means than pi

What are you basing this on?

Is it your opinion that the Python implementation of Tau was a mistake?

I would like to add that in addition to Google’s calculator, DuckDuckGo’s calculator also has implemented Tau.

Try writing in tau + 1

Personal experience.

Yes.

The job of a search engine is to know everything. We should not add things to the language just because a search engines knows about them. That's really not a relevant piece of data at all.

Your «argument» that;

would imply that, simply becouse something is established, and people «do fine» with it, we should not implement improvements.

Then what is the purpose of this forum? Is it simply to fix «bugs» in JavaScript?

Or isn’t it to improve overall?

I think what you really mean, is that the improvement of adding Tau, is not worth the effort. That the improvement is to small. If my assumption is correct, then why do you think adding Tau is to small of an improvement?

Are you qualified to quantify the improvement? Have you experienced the frustration of working on math problems with 2pi?

If you have, then i respect your opinion, if not, then allow those who care about this change lead the way, as it does not stand in the way of those who still wants to use Pi.

Adding a new constant would be very little effort. My position is that it would make the language worse, because then people like yourself would use it, and thereby make their code less readable to a majority of readers. I want people to use 2 * Math.PI or to write const tau = 2 * Math.PI; at the top of their files instead, so that people will actually know what they meant.

Have you experienced the frustration of working on math problems with 2pi?

I have a degree in math. It's really not that annoying.

If they are allowed to write

const tau = 2 * Math.PI;

Would it not be simpler to just write Math.TAU?

Then it would at least be documented!

To you, but what about those who disagree with you? Are your preferences more important?

The documentation would be elsewhere instead of in the code. Readers would have to look it up instead of just reading the code, for almost no benefit. That's worse. That's my point.

I don't think there's really anything else to say, so I'm going to step away from the discussion now.

The documentation would be elsewhere instead of in the code.

Yeah, just like Math.PI is documented elsewhere.

Unless you use TS offcourse, (which i do)…

I actually enjoy using Tau in python as well. But, I've really only used it when crunching numbers, not when I'm trying to write code that I expect others to maintain (I often use python's REPL like a calculator).

When it comes to writing code for everyone to read, I tend to agree with @bakkot that if you want to use Tau, it's better to just add that extra declaration at the top of your file so everyone unfamiliar with Tau can see, at a glance, what it is as they're reading your code. Why, I even would occasionally do the same thing on my math homework back in the day - I'd use Tau, but only after I had defined it in that same problem I was using it in. I think this is a healthy thing to do for concepts you want to use that are not as commonly known - it's easier to see what Tau means by seeing how it's defined in the same source file rather than looking it up (unfortunetally not everyone's ide is smart enough to pop up documentation, and I want the code to be readable for those folks as well).

1 Like