Live data from Hacker News

Turns are Better than Radians (2022)

computerenhance.com

41–50 of 225 posts

Re: Turns are Better than Radians (2022)

#42

And could use fixed-point decimal for more efficiency since can store as integers and use integer hardware for them. So for instance with 32-bits, the 16 most-sig bits store the number of turns and the 16 least-significant bits store the fraction of a turn. Then if you want to wrap angles that exceed 360 degrees back around the circle, you can simply Logical_AND with 0x0000FFFF. And while you are at it, you could jus…

Binary fractions of a turn are also a nice intuition pump for two's complement in general.

Let's keep it simple and use just 8 bits. 0° is 0x00, 180° is 0x80, and 255/256ths of 360° is 0xFF. And if we wanted to use signed integers, then 0x80 through 0xFF - the high-bit half of the range - now represent the negative quadrants just as they represent negative integers.

Re: Turns are Better than Radians (2022)

#43
post #2

I like to store angles as turns in my own code, because (as noted) it makes quarter-turns computable without rounding. OTOH if you need, say, twelfths of a turn, you might want to just store angles as degrees since that’s already common. Michael Spivak, in Calculus (3rd ed p. 301) considers the unit choice to be a property of the function and initially defines sin° and sinʳ (before settling on sin meaning sinʳ) and c…

You generally can’t apply functions to dimensional units. The only thing units can do is be multiplied or divided together. So I can multiply a mass by a distance or divide a distance by a speed, and I can multiply the result by a scalar; but I can’t take the sine of a distance or the logarithm of a time or exponentiate a mass. Those are things I can only do to scalars. ‘But wait!’ You may cry: ‘the formula for a tra…

Well you can also square root etc.

Re: Turns are Better than Radians (2022)

#44
post #33

Earlier quoted context omitted.

Every part of calculus with trig functions relies on this fact! The rate of motion along a circle is approximately linear at the same speed when described in radians. For example when you do a Taylor series expansion the cos/sin are well approximated by x.

That's why I put "directly" in my original post. All the nice functions in calculus rely on that fact, but that fact itself is almost never used or useful by itself . If I were writing the article I would focus on the benefits for derivatives and integration and other things that are slipping my mind at the moment. I wouldn't waste time going down the rabbit hole of why. At least not for an article aimed at this type…

Your awareness of a key relationship does not make it irrelevant. It happens all the time in math.

the article acts like radians are arbitrary without discussing this key property.

Re: Turns are Better than Radians (2022)

#45
Here's another good reason to think in turns: it turns Euler's formula from this Eldritch Terror:

    e^(i*x) = cos(x) + i*sin(x)
into something you can kinda understand by staring at the complex plane:

    -1^(2x) = cost(x) + i*sint(x)
Credit to justinpombrio for this: https://news.ycombinator.com/item?id=32986869

Re: Turns are Better than Radians (2022)

#46
I argued this idea to a couple of my classmates when I was a physics undergrad, and they agreed. However, I later changed opinions because of what this does to the derivatives/integrals of your trig functions.

For general periodic functions, [0, 1) is a good domain. But circles and spheres are geometric objects, and radians/steradians are geometrically significant units that are well suited for general purposes.

I do remember that Doom uses an interesting alternative representation where an angle is a u16 multiple of `(2 * pi) / 65536`. Fixed point is sometimes a good choice in games and simulations due to having uniform precision.

Re: Turns are Better than Radians (2022)

#48
Norman Wildberger has an alternative system for trigonomtry:

Understanding uniform motion: are radians really necessary? | WildTrig

https://youtu.be/CnQXRdgN_7I?si=EiYY99i6mBOIyczI

Wild Trig: An introduction to Rational Trigonometry

https://youtube.com/playlist?list=PLIljB45xT85CyF_7bKd6y36VA...

Re: Turns are Better than Radians (2022)

#49

I think I cautiously agree with this notion to some extent, but IMHO the real answer is that it's application-dependent, and if you're writing a low-level trig library and you have to pick one or the other, it really isn't clear to me that turns should win over radians. I expect many systems that use trigonometry would sometimes use small-angle approximations either for efficiency or to bootstrap to the general case.…

I don't have a super-wide gamut of experience here and numerical analysis isn't my specialty, but nearly all trig implementations I've looked into (in both software and hardware) make heavy use of lookup tables and other shortcuts. I've never seen a Taylor series used in a general implementation - not saying it doesn't exist anywhere, but in most cases that I'm familiar with you could support turns just as easily wit…

I've used Taylor series in numerical optimization. A function we were implementing needed to be differentiable (for automatic differentiation), but its definition had a special case, so we used a couple terms of the Taylor series in the special case.

edit: Sorry, to clarify, this was a function involving trigonometry but not simply vanilla sine or cosine. However, angular values being represented in radians did help in the same way I described in the parent post.

Post reply on HN