25 ms·
Turns are better than radians
- ClassyJacket 4y agoI'm so glad someone else finally said this. This article takes the approach of simplicity of code, which I do agree with, but additionally I've been thinking turns would have to be more intuitive and easier to teach (particularly to disinterested teenagers) for YEARS, and I finally feel vindicated at least one person agrees with me. Turns are really the most neutral way to count an angle. We don't use them for everyday physical things because the numbers we'd deal with would be too small to work well for feeble human minds, hence degrees. But for the mathematical world where we currently use radians, turns make so much more sense.
- CogitoCogito 4y agoThe mathematical world doesn't only use radians. Parametrizing with a factor of 2*pi is totally common. Sometimes it’s called the winding number which here is called turns. But yeah the overall point is good. Use language appropriate to the problem at hand.
- pestatije 4y agoSo now the diameter is 1/pi turns?
- ncmncm 4y agoNo, 2/tau turns, philistine. ;-)
- jjgreen 4y ago... and the derivative of sin(x) is ... ?
- jan_Inkepa 4y agoRight - there's a negotiation in terms of complexity. The coefficient baggage has to go somewhere. For me I don't want to care which units I use (and I'm rarely inspecting the exact angle as a number) - consistency is most important. I'm rarely interested in the precise numerical value of an angle - it's just a thing in the graphics/physics pipeline somewhere. I don't know if that makes me agnostic about this proposal or conservative.
- ncmncm 4y agoWhen you store a value that will be reused, like in an array of points, if every time you walk the array multiplying by a constant, you should seek to store values in such a way that it does not need that treatment. If you are taking sin and cos each time through (presumably, added to some angle), it should be pre-multiplied for the fastest implementation of sin and cos available.
- trashtester 4y agoRe(exp(ix)). Using degrees, turns, etc instead of radians, is like using 10^y instead of e^x (where y=x/ln(10)). Useful for many practical things, but useless for a lot of math applications, especially involving differential equations, complex numbers etc.
- Dan42 4y ago> and the derivative of sin(x) is ... ? I believe it's cos(x). And I fail to see how that would change regardless of what unit x is expressed in. Sorry, my trig is veeery rusty.
- jjgreen 4y agoOnly when the angle is in radians ...
- flowerbreeze 4y agoMy favourite way of handling angles was always with either unsigned char or 16bit unsigned int that was treated as 1/nth of turn. Usually in these cases cos/sin tables were pre-calculated for speed, although that need went away to an extent. As long as as the calculations wrap around on the underlying system, it makes angles much easier to manage, because angle1 + angle2 = angle3 is always within 0 to 255 or 0 to 65535. Unfortunately I mostly work with higher level languages now that have mostly dropped integer types. If anybody knows how similar calculations can be easily achieved in JS for example, I'd love to hear about it. I'm sure there must be a better way than boundary checks and manual wrap-around.
- Klaster_1 4y agoFor overflowing integers in JS, you can use single-value long typed arrays. I just checked with an Uint16Array and it wraps back to 0 after 65536.
- flowerbreeze 4y agoThank you! This works great as well for my purposes: > a = new Uint16Array(1) Uint16Array(1) [ 0 ] > a[0] 0 > a[0] = a[0] + 65537 65537 > a[0] 1
- vardump 4y ago> If anybody knows how similar calculations can be easily achieved in JS for example Simply "a = (a + 0x1234) & 0xffffffff;". Or whatever width you require, 0xff or 0xffff. JIT is going to optimize that and-operation away (at least for 32-bit mask 0xffffffff) and keep the integer value internally. You can also "cast" a var to int by "ORring" 0 with it, like "a |= 0;"
- flowerbreeze 4y agoThank you! This does exactly what I meant. I think this is the best solution for my use-cases. It even handles floating point operations to a correctly, something I didn't expect.
- 4y ago
- lordnacho 4y agoThat was quite convincing actually. I guess we all have this realization at some point in early math education. Why is it 360 degrees? Mainly because that's a nicely divisible number, no other good reason. Sometimes you find a 400 degree system on calculators but it doesn't seem to be taught anywhere (is it a French thing?) Then at some point you get shown radians, which relates the arc length to the radius. That somehow seems natural, but it does mean there's going to be this constant lying around somewhere in your calculations. Parameterizing the angle as a proportion of how big it can be (number of full circles) seems pretty sensible. I mean if you can avoid the constant for at least some of your geometry, then why not?
- krajzeg 4y agoThe 400 system is the grads or gradians, indeed originating from the French revolution. Nowadays I don't think they're used as the principal unit in any country. Wikipedia does mention it gets some use in specialized fields such as surveying, mining and geology.
- gfv 4y agoThey are used indirectly through distance. At the time, the meter was defined as one ten millionth of the distance between the north pole and equator through the Paris meridian. That means that the meter corresponds to 1/100000 of a grad of latitude -- which is better read as "a kilometre is 1/100 of a grad". This is symmetrical to the nautical mile, which is one minute of arc.
- severak_cz 4y agoIt's 360 degrees because of stars. One degree is how much stars move by one day.
- smitty1e 4y agoTurns sound fine. But they are turns of a circle of a given radius. So as long as everything conforms to that coordinate system, we're groovy? Radians (circle fractions) are generally preferred because we can compare, e.g. two planetary orbits, conveniently, no? Or did I miss something?
- 317070 4y agoRadians are not circle fractions. Radians _divided by 2pi_ are circle fractions. OP is proposing to use circle fractions instead of radians.
- carpenecopinum 4y ago> But they are turns of a circle of a given radius. > Radians (circle fractions) It's the other way around actually. A turn is a turn, no matter the radius of the circle. Radians are the length of the line you need to draw a fraction of a circle with a radius of 1. (In the end, both are just ways to describe angles and thus independent of any radii... the only effective difference between them is a constant factor of tau or two pi.)
- deadbeeves 4y ago>But they are turns of a circle of a given radius. No, a revolution is a revolution. If you turn a 1 m wheel by one revolution and a 2 m wheel also by one revolution, both will have turned one revolution, or 2 pi radians. If you roll both of them 2 pi m forward on the ground, one will have turned one revolution, or 2 pi radians, and the other will have turned half a revolution, or pi radians.
- IshKebab 4y agoThis is quite convincing but it would have been more convincing if he'd acknowledged the downsides and explained why it is in radians in the first place. (On balance I think he's probably still right.) Perhaps we can make new named functions that operate in turns, along the same lines as ln/log. sint, cost, etc. Ok maybe not cost.
- gjm11 4y agoWe manage OK with cosh for the hyperbolic cosine even though "cosh" is a word. For that matter, "sin" and "cos" are both words, though of course "sin" and "sin" are pronounced differently.
- IshKebab 4y ago`cost` is a normal variable name in a lot of code though, whereas `cosh` definitely isn't! In fact I bet you can't find a single use of `cosh` in code that isn't talking about hyperbolic cosine.
- nurbl 4y agoI agree that this makes sense for the kind of situations that the article talks about. If you only need to express common angles like 90 degrees, 45 and so on, radians are just messy (though in physics, you get used to it). But in other cases, radians are useful. For example consider the case of small deviations from a direction. If you give it in radians, let's say three mrad (milliradians), it's very easy to estimate how large the error will be over the course of a meter; three mm. This is just to say: choose the right unit for the job.
- jefftk 4y agoTo elaborate a bit: that works because sin(x) is very close to x for small x, but only when x is measured in radians.
- shadowgovt 4y agoThat's because of the equality relationship between 2π radians and the length of the unit circle perimeter. If one is working with a sine taking in turns, one can just adjust by saying sin(q) ≈ 2π * q for small q.
- sacrosancty 4y agoalso known as the fundamental theorem of engineering. Works great for small deformations of stiff materials like steel and concrete.
- WastingMyTime89 4y agoI’m surprised game engines do conversion from degrees to radian to call trigonometric functions. I would have called that bad code in an industrial context. We did everything in radians and converted to degrees only for displaying and input. It was a lot more natural from us because we are a lot more familiar with radians anyway. I don’t think I have used degrees often since starting high school twenty years ago.
- qwery 4y ago> We did everything in radians and converted to degrees only for displaying and input. This is generally how game (engine) code works as well. The example in the article is an example of performing that conversion, except with turns instead of degrees.
- codeflo 4y agoI consider APIs that use degrees essentially broken. (And similarly, APIs that express ratios as numbers in [0, 100].) But you have to consider that a lot of game engines and related tools are intended for an audience without a strong programming background. You wouldn’t expect a 3D modeling tool to display radians. And if the UI shows degrees, the file format would better use degrees as well to avoid rounding errors. And then maybe you want the scripting layer to use the same values that the UI does. And so on.
- anonymoushn 4y agoThe post says that programmers convert to radians to call APIs that take radians and then immediately divide by pi before computing the sine. So doing everything in radians would still involve an extra floating point divide compared to the alternative.
- WastingMyTime89 4y agoNo, you are confused. That’s a conversion back to degree after computing the sine. You don’t randomly divide by pi for no reason.
- 4y ago
- tromp 4y ago> Some time ago, much effort was expended to convince people to replace approximations of “pi” (3.14159…) with approximations of “tau” (6. 28318…). IMO the effort was simply to replace the use of pi with the use of tau. What does approximation have to do with it?
- eesmith 4y agoIt's a correct description. (Perhaps further refined as "technically correct".) The following are not exact values of π or τ, only approximate ones: >>> import math >>> math.pi 3.141592653589793 >>> math.tau 6.283185307179586
- SuchAnonMuchWow 4y agoThe effort wanted to replace all uses of Pi (including the ones in math formulas) and not just their use in (floating-point) computer programs where we implement approximations of those formulas.
- eesmith 4y agoSure. But just because there was {a lot of work to replace all uses of pi with tau} doesn't mean there wasn't {a lot of work to replace all approximate uses of pi with approximate uses of tau in computer programs}.
- ComputerGuru 4y agoRight, which makes it an effectively incorrect description. It is like if I said I wanted to change all green fruits to orange ones and you reported that as "my undertaking to change green apples to orange apples." It's the truth, but it's not the whole truth.
- eesmith 4y agoAs I noted parenthetically: Perhaps further refined as "technically correct". Nothing in the rest of the article deals with pi or tau as transcendental numbers, only about a bit patterns and (implicitly) floats or doubles. If your focus is IEEE 754 apples, then perhaps other sorts of fruit aren't so important?
- rikroots 4y agoOn the frontend, one thing that I discovered when implementing color spaces into my canvas library was that the CSS HWB standard[1] allows the hue part of a color (which is an angle value) to be supplied supplied as either 'Ndeg', 'Nrad', 'Ngrad' or 'Nturn' values. Other CSS color spaces involving hue don't see to accept 'turn' (though I could be misunderstanding them). [1] - https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/hwb https://developer.mozilla.org/en-US/docs/Web/CSS/color_value...
- chrismorgan 4y agoYou’re misunderstanding things. CSS is typed, and deg/rad/grad/turn are all just angle units; anything that takes an <angle> supports angles in any unit. hsl(0.5turn 100% 50%) is equivalent to hsl(180deg 100% 50%) and #00ffff (and infinite other spellings). When it was introduced, hsl() only took a <number> for hue, which was interpreted as degrees, but it has had proper <angle> support for over a decade (apart from Opera which only got it with the switch to Chromium in 2013). The current state of affairs is `<hue> = <number> | <angle> | none` (https://drafts.csswg.org/css-color-4/#hue-syntax https://drafts.csswg.org/css-color-4/#hue-syntax), and <hue> is used by hsl(), hsla(), hwb(), lch() and oklch().
- rikroots 4y agoAh! Thanks for the explanation. I'll need to fix this in my library.
- chrismorgan 4y agoI recommend reading specs regularly when doing anything like this. Web specs are generally pretty approachable, and they generally match implementations very closely these days (largely because the implementers are the spec-writers, which wasn’t so much the case before, say, the HTMLL5 effort), with the caveat that parts of these drafts precede the implementations and thus may end up being altered due to implementation experience.
- mjw_byrne 4y ago"math never decreed that sine and cosine have to take radian arguments!" This is at best questionable and at worst false. If you only want to use sin and cos as functions for doing trigonometry, it is true that you can choose whatever angle unit you like and stick with it and it will be fine. For most other stuff, e.g. differential equations, complex analysis, signal processing and mechanics, it's pretty much inescapable that the zeroes of sin are at integer multiples of pi, and that's that.
- Double_a_92 4y agoWhy do they need to be at multiple integers of pi, instead of at half turns?
- qsort 4y agoBecause - numeric precision arguments aside, there's an excellent comment explaining that problem in this thread - it's the only unit of measurement that makes sense for angles. It provides an easy way to connect the complex exponential with trigonometric functions (and everything you get from that, i.e. Taylor series, nice behavior in diffeqs). You can do the same in degrees as well, but you end up with weird conversion factors with pi in the denominator, a strong indication you should have multiplied by pi to begin with.
- cillian64 4y agoIf you differentiate sin(x) with respect to x then you get cos(x), but only if your trig functions are using radians. Any other unit results in an extra coefficient appearing. That’s not an insurmountable problem, but radians are the fundamental unit here, not just an arbitrary choice.
- bvrmn 4y agoI could forget something but sin'(ax) = cos(ax). If a is a constant factor.
- 4y ago
- adrian_b 4y agoWhile I agree that "turns" are much more convenient in some applications than radians, there is no need to invent a new terminology. For a long time, including the 19th century, the plane angle measurement unit corresponding with 4 right angles, i.e. a complete rotation around a point, has been named "cycle". That is why in many old physics or engineering books one will find wave numbers measured in "cycles per meter" and frequencies measured in "cycles per second", for example what is now called as a frequency of "10 MHz" was called as a frequency of "10 megacycle per second". There are 3 important measurement units for the plane angle and each of them is the most convenient unit for a certain class of applications: the right angle, the cycle and the radian. (An example where the right angle is the most convenient unit is when expressing a complex number with unit modulus as (i^x) instead of the (e ^ (i * x)) that is used with radians.) Using the inappropriate plane angle measurement unit for an application causes a loss of precision (which can be large for large angles that must be reduced to the 1st quadrant) and introduces extra arithmetic operations that are not needed. The radian is used much more frequently than it should be used because many standard programming libraries provide only trigonometric functions with arguments in radians, which is a big mistake. The recent versions of the Floating-Point Arithmetic standard recommend the functions sinPi, cosPi, tanPi, atan2Pi, asinPi, acosPi and atanPi. This is another serious mistake, because one normally needs either the trigonometric functions of (x * Pi * 2), i.e. with angles measured in cycles, or those of (x * Pi / 2), i.e. with angles measured in right angles, and never the functions of (x * Pi), which are recommended by the standard.
- galangalalgol 4y agohttps://en.m.wikipedia.org/wiki/Binary_angular_measurement https://en.m.wikipedia.org/wiki/Binary_angular_measurement BAMS has been in use for several decades where fixed point is the norm. DSP for instance.
- layer8 4y ago> there is no need to invent a new terminology. It's not a new terminology: https://en.wikipedia.org/wiki/Turn_(angle) https://en.wikipedia.org/wiki/Turn_(angle)
- 4y ago
- bmacho 4y agoBTW the wikipedia page for angle uses primarily turns. See e.g. this table: https://en.wikipedia.org/wiki/Angle#Measuring_angles https://en.wikipedia.org/wiki/Angle#Measuring_angles .
- dusted 4y agoYea, I have some macros cysin and cycos that does that, I just call them cycles instead of turns, but it's the same idea.. ofc internally those are still stupid and just multiply by tau..
- fbanon 4y ago>But math never decreed that sine and cosine have to take radian arguments! Ummm, actually it did. The Taylor-series of sine and cosine is the simplest when they work with radians. Euler's formula (e^ix = cosx + isinx) is the simplest when working with radians. Of course you can work in other units, but you'll need to insert the appropriate scaling factors all over the place. "Turns" don't generalize to higher dimensions either. With radians you can calculate arc length on a circle by multiplying with the radius. This extends naturally to higher dimensions: a solid angle measured in steradians lets you calculate surface area on a sphere by multiplying with the radius. How do you do the same with "turns" on a sphere? You can't in any meaningful way.
- doliveira 4y agosin(x) ~~ x only in radians, so honestly that's reason enough. Once in a while we get programmers wanting to disrupt mathematical notation for whatever reason... Worst I've seen so far was one arguing that equations should be written with long variable names (like in programming) instead of single letters and Greek letters. Using turns because it's a little easier in specific programming cases is just as short-sighted, I'd say, it doesn't "scale out" to the myriad of other applications of angles.
- MayeulC 4y agoThat's only for small angles though (stems from Taylor's expansion). With other units, you have a conversion factor, but it remains true enough at small angles.
- fbanon 4y agoOr just defining the result of division by zero as zero "for safety": https://www.hillelwayne.com/post/divide-by-zero/ https://www.hillelwayne.com/post/divide-by-zero/ It boggles the mind, truly!
- jgwil2 4y agoAre you claiming the author is incorrect that x/0 = 0 is mathematically sound?
- shultays 4y agoThis is like complaining about g in F = g * m, in gravitional force formula, and redefining gravitional constant g as 1 and multiplying "gram" by 1/9.8. Sure it simplifies things for you but you are breaking everything else that used g constant Or we can redefine seconds perhaps and multiply it sqrt(1/9.8)
- vrc 4y agoSee Gaussian-CGS v. SI units [0]. It really confused me going from a CGS physics class to an EE electrodynamics course! [0] https://en.wikipedia.org/wiki/Gaussian_units https://en.wikipedia.org/wiki/Gaussian_units
- oddthink 4y agoOh yes. This is definitely a pet peeve of mine. CGS is so much nicer. I did E&M from Jackson before he converted it to MKS, and I still can't keep all those epsilon_0 and mu_0's straight. (Not that it comes up all that much.)
- zarzavat 4y agoy’’ = -y Radians are God’s chosen angular unit. If you want to do mathematics, you have to use radians.
- gugagore 4y agoBecause I didn't see it mentioned yet, this is the same feature that makes the small-angle approximation of sin elegant: sin(x) ≈ x .
- tsimionescu 4y agoWith a sin designed for turns, that is just sin(x) ~= 2pi * x or tau * x. Slightly uglier, but still quite simple.
- anonymoushn 4y agovideo games don't usually need to take unitless derivatives of sines.
- 7steps2much 4y agoTrue, but if you are talking about video games in particular you could just build a sin/cos function with different parameters into the game engine. have a `sin(x)` where the unit of x is radiants and a `sin_turn(x)` where x is expressed in turns. Video games especially are a great situation to do it like this because they often use a framework (game engine) that was specifically created for this purpose.
- anonymoushn 4y agoYes, this is the topic of the fine article and the point that is being made. Ideally both of the multiplies (one in the user code to multiply by pi and another in the engine code to divide by pi) can be omitted.
- bmacho 4y agoWhat subfield of mathematics? Surely if you do differential equations, your trigonometric functions will eat radians. But e.g. for geometry, where you do basic arithmetic operations on angles, turns are a bit more convenient than radians. (Radians are not that inconvenient if you denote 6.28 somehow, but then again, why not just use turns.)
- mikessoft_gmail 4y ago
- the_other 4y agoI'm interested in this from the perspective of learning maths, rather than writing code (for now). I've wondered for a few years now whether teaching angles and trig using turns, rather than degrees or radians, would be better from the very beginning. Degrees are arbitrary and based on the numeric preferences of a dead culture, rather than on what's happening on the page or in 3d space. Radians seem better because the units are related to a property of the circle, but they're hard to visualise and reason about because they don't fit a circle in whole numbers. Surely turns are the most clear. I'm rusty and don't practice maths much. If I did I'd probably have the skills of 14y/o me, for anything outside set theory. I'd definitely do a trigonometry course based on turns if I could find one.
- jayjader 4y ago> but they're hard to visualise and reason about because they don't fit a circle in whole numbers. I think, unfortunately, that you can't avoid encountering irrational numbers in trig. You would need to constrain yourself to working only with right angles, but in those cases sin and cos are trivial[0] so there would be no need to use trig in the first place. [0]: 1 or 0, you're either on the right axis or you're not. No circles involved.
- Izkata 4y ago> Radians seem better because the units are related to a property of the circle, but they're hard to visualise and reason about because they don't fit a circle in whole numbers. When I was learning this in school, radians were always expressed as (fraction * pi), not the final number.
- bluGill 4y agoRadians makes the most sense just because (as others have pointed out) pi appears all over in math, and in all those places if you are working with a unit of raidans the math becomes a lot easier. In a few cases turns are easier to work with, but teaching them is a dead end to the vast majority of students who will never work in those domains, and even the few students who work in a domain where turns make sense they will still spend time in other areas of math that works much better in radians.
- ttoinou 4y agoThere is also Rational Trigonometry to get rid of cos and sin in general
- aaaaaaaaaaab 4y agoA Wild Berger has appeared!
- nj65537 4y agoNot closely related, but the topic reminds me of this gem of a question from math.SE: Why does "Turn! Turn! Turn!" equal 241217.524881? (It's because of the calculator, but not in an obvious way.) https://math.stackexchange.com/questions/4207222/why-does-turn-turn-turn-equal-241217-524881 https://math.stackexchange.com/questions/4207222/why-does-tu...
- exo-cortex 4y agoIs there a Rust library that also takes "turns" (or cycles or something similar) that I can use? I have been wondering (very low-key-ish) about this problem for some years and now that I know this I want to use turns in my code.
- amelius 4y agohttps://tauday.com/tau-manifesto https://tauday.com/tau-manifesto
- phao 4y agoThe major motivation for radians is arc length parametrization, really. Meaning that in a circle of radius 1 unit (in whatever measurement unit you've chosen), an arc formed by a k-rad angle measures k units. There is an intentional coincidence of angles and arc measurements.
- DeathArrow 4y ago>But math never decreed that sine and cosine have to take radian arguments! To define trigonometric functions you need angles. Which can be measured in degrees or radians. If angles, degrees or radians wouldn't matter, those functions would be some ordinary real functions and not called "trigonometric". https://www.math.net/sine https://www.math.net/sine
- jefftk 4y agoWhich can be measured in degrees, radians, or, as the article recommends, turns.
- jonasenordin 4y agoYes! And corresponds nicely with 'spats' for solid angles. https://en.wikipedia.org/wiki/Spat_(angular_unit) https://en.wikipedia.org/wiki/Spat_(angular_unit) 1 spat = 4 pi steradians.
- xchip 4y agoVery nice article
- pdpi 4y agoIndeed, maths never "decreed that sine and cosine have to take radian arguments". But thinking that makes any sort of point is a fundamental misunderstanding of maths. There are infinitely many sinusoidal functions out there. You can just adjust amplitude, frequency and phase to your heart's content. Trigonometry basically requires that sine and cosine have specific amplitudes and phases, but gives not one shit about how you map angles to frequency. Degrees are completely arbitrary, but both radians and turns have pretty natural definitions, with turns indeed being the easiest to work with. So far so good. Calculus does have an opinion on frequency, though. There is exactly one non-trivial pair of sinusoids s(x) and c(x) where c'(x) = - s(x) and s'(x) = c(x), among a bunch of other very useful properties. When you put calculus and geometry together, s and c are have the same amplitude and phase as sine and cosine from geometry, and the two pairs are exactly the same if you match the frequencies such that the argument is the angle measured in radians. It's just so damned useful to use angles in radians and make everything play together nicely.
- deleted 4y ago[deleted]
- jacobolus 4y ago> Degrees are completely arbitrary Degrees are very natural in the context of ancient astronomy/astrology, where you have (1) ~365 days in a year, so that if you look at the path of something that takes a year you get about one degree change per day but with a number that is more easily divisible. (2) approximately 4y, 10y, 8y, 15y, 12y, 30y cycles for the moon and various planets. (3) A calendar with 12 months, 12 zodiac signs. (4) A timekeeping system which breaks days into 24 hours and then uses divisions by sixty for smaller units. (4) A base-sixty number system – from ancient Mesopotamia, which persisted as the standard for astronomical calculations for millennia, only displaced in the very recent past.
- sicariusnoctis 4y agoAll those approximations have error and the behaviour you describe depends on where you are on Earth. Moreover, degrees are not natural from a mathematical perspective.
- otikik 4y agoFun fact: PICO-8 only provides turn-based trigonometric functions https://pico-8.fandom.com/wiki/Sin https://pico-8.fandom.com/wiki/Sin > PICO-8 uses an input range of 0.0 to 1.0 to represent the angle, a percentage of the unit circle. Some refer to these units as "turns". For instance, 180° or π (3.14159) radians corresponds to 0.5 turns in PICO-8's representation of angles. In fact, for fans of τ (tau), it's just a matter of dropping τ from your expression.
- scambier 4y agoHere are the algorithms for PICO-8's sin(), cos() and atan2(), as implemented by the Picolove emulator: https://github.com/picolove/picolove/blob/4b79a3b7ebd1d1bc6c2838b43856e2ac2ff5f84b/api.lua#L1357-L1369 https://github.com/picolove/picolove/blob/4b79a3b7ebd1d1bc6c... Also, since PICO-8 coordinates have their origin in the top-left corner (y goes down), sin()'s result is also inverted.
- smcameron 4y agoBack in the early 80's a common thing to do in games on 8 bit computers was to implement sin and cos as lookup tables with the angles being 0-255 or 0-128 or something like that and the result also an integer that was some fixed point representation, so you'd do something like: vx = (cos[angle] * speed) >> 8; vy = (sin[angle] * speed) >> 8;
- kennywinker 4y agoOuch. Less than 1 degree of accuracy? Well, I guess if it’s good enough for Asteroid, it’s good enough for me
- londons_explore 4y agoYou can always do one cycle of newton-raphson to get nearly double the accuracy with only one extra lookup-multiply-add.
- kennywinker 4y ago
- gorkempacaci 4y agoIf the op had claimed this is only about API design and efficiency, he'd get much less shit because he has a good argument there.
- djbiccboii 4y agois he getting shit?
- analog31 4y agoIn my view, because pi crops up unavoidably in math, if you concoct a "unit" to get rid of pi in one place, it will simply crop up somewhere else, perhaps in a denominator. For instance: The ratio of rise to run for small angles. Working in optics, radians are such nice units: A milliradian is a millimeter per meter or a "mil" per inch.
- phao 4y ago> In my view, because pi crops up unavoidably in math, if you concoct a "unit" to get rid of pi in one place, it will simply crop up somewhere else, perhaps in a denominator. That doesn't mean you shouldn't try to put it in a convenient place. One way to think of the post is: where you want pi to come up? With arc length parametrization f(r) = (cos(r), sin(r)), it comes up in the parameter space (one turn: 0 <= r <= 2 pi). If you had the whole thing in terms of turns, you'd instead have (as a primitive) some kind of function g(t); with one full round for 0 <= t <= 1. It'd then have to be true that f(2 pi t) = g(t) = (cos(2 pi t), sin(2 pi t)). Pi would come up in the velocity: f'(r) = (-sin(r), cos(r)) = if (i u means rotate the vector u by 90 degrees counter-clockwise) g'(t) = 2 pi f'(2 pi t) = 2 pi (i f(2 pi t)) = 2 pi (i g(t)) Before, you had |f'| = 1. Now you have |g'| = 2 pi. For classical physics (kinematics and dynamics) applications and classical geometrical applications (curvature, etc), it's really convenient to have that speed term (|f'|) being 1. This is one of the major motivations for arc length parametrization. By the way, this can't be understated. It really simplifies kinematics, dynamics, geometry, etc, having |f'| = 1 throughout. It's not just for circles. This can be done for an extremely large class of curves and it makes the related math much more understandable and easier to deal with. For a lot of computer graphics (I believe this is where Casey comes from), you care less about tradicional mathematics for physics and geometry. So you'd rather (maybe) take this pi appearing in the parameter space and push it to the velocity.
- deleted 4y ago[deleted]
- throwawayffffas 4y agoFun fact the radian is a unit in the SI.
- mihaaly 4y agoThis constant need to redefine the known world around a favourite detail amazes me. Are people that bored?! (also I itch hearing the idea of redefining interface - and the world - to fit the implementation detail. how about reimplementing using the [0...0.7854] domain instead of the [0...1] if this is such a huge worry after decades of computing - on slower machines - with the natural radian (arc_length/radius) values? I feel Godot engine should fit the world and not the other way around.) > Math doesn’t require radians. ....What?!?! Circumference, radius and volume, just to name some, try calculate those easily on turns only (without a new constant introduced!).
- happimess 4y agoI think that the author is speaking about their world, in which they regularly encounter a specific use of trigonometric functions which would be simplified (conceptually and computationally) by skipping the conversion from and into radians. > redefine the known world around a favourite detail I think that's a good way to think about software optimization. Deep inside nested loops of a game engine (TFA's example code comes from Godot), that's often what you need to do to squeeze some performance characteristic into your hardware.
- mihaaly 4y agoI think they are trying to expand it beyond their world. They already have this in their world! Shown with examples. Just want it elsewhere as well. Not everything is about software automation! Especially in this regard where decade long established practices work on legacy hardware and systems. This is ruining/complicating things for some chip of the scope.
- RicoElectrico 4y agoTurns could be useful if you calculate trig functions with CORDIC. This should simplify the math here.
- LtWorf 4y agoOld controversy. Relevant xkcd https://xkcd.com/1292/ https://xkcd.com/1292/ Basically it's simpler but it makes most formule more complicated by adding constants all over the place.
- jawadch93 4y ago[dead]
- whatiskolnprob 4y agohttps://forums.developer.nvidia.com/t/a-more-accurate-and-potentially-faster-double-precision-sincospi-implementation/39071 https://forums.developer.nvidia.com/t/a-more-accurate-and-po... Justification for using pi units
- panda-giddiness 4y agoAs already mentioned by others, radians are not arbitrary units for angles; in fact, they are the "natural" "units", so to speak. By definition, an angle is just the ratio of a circular arc (s) to its radius (r), θ = s/r (as an exercise, imagine how to apply this definition to the angle between two intersecting lines). When the length of the circular arc equals its radius (s = r), the angle subtended is exactly 1 radian; of course, since this is just a ratio, 1 radian is exactly the same as 1 numerically, which is why I put "unit" in quotes earlier -- a radian is not really a unit at all! A degree, in contrast, equals pi / 180 radians. Of course, since 1 radian = 1, that really just means that 1 deg = pi / 180, similar to how 1%=0.01. Putting this all together, it is perfectly parsable (although not recommended) to say that a $5 burger costs roughly $29000% deg.
- gernb 4y agowhy radius and not diameter?
- munchbunny 4y agoIt's a good question since "radius" seems somewhat arbitrary, but the reason for defaulting to radius is that the unit circle (radius 1) produces convenient numbers in general in a way that a circle of diameter 1 doesn't. However, that doesn't mean that it's the most parsimonious choice for your particular application.
- btilly 4y agoThe fact that it is natural doesn't make it performant and straightforward for all applications. For example linear algebra is the natural and general way to handle vectors. However game developers still find quaternions faster and more performant.
- SideQuark 4y ago>The fact that it is natural doesn't make it performant and straightforward for all applications. How does changing the scale make anything more or less performant? If anything, it makes things less performant since to use any hardware supported trig functions you now have to convert your weird angle representation into radians. For simple addition or fractions of your angle, it is just as performant as using angles in any scaling. > For example linear algebra is the natural and general way to handle vectors. However game developers still find quaternions faster and more performant. They only use quaternions for a few things, like slerp, and mostly because of gimbal lock. For everything else they still use linear algebra, and linear algebra is used much, much more than quaternions for nearly any 3d program.
- throwawayffffas 4y agoWell I don't think they are. Sure they make computing the function simpler. But I would hazard that most people that use these functions are not doing geometry and they are already working with radians. In short if you give any kind of engineer working on any kind of signal processing domain a sine function where sin(1) = 0 you are only going to confuse them. PS: that's why mathematicians don't use turns they are mostly not doing geometry and radians in that case typically make for better formulas.
- isitmadeofglass 4y ago> sin(1) = 0 you are only going to confuse them. Not really, pretty much every single one would assume you just forgot the pi, because everyone writes “sin(1pi)” and never actually “sin(3.14…)” because no one ever writes down numbers in the unit of radians, they already convert to half rotations or full rotations by scaling with pi. Imagine if someone went “nanometers are a dumb unit, because I always write down my numbers as h=342 x 10^-9m” that last part “10^-9m” is just nm. In the same way that sin(1.432pi) might as well just be written sin(1.43*rotation). Arguing for radians is arguing that the most natural way to write it is sin(8.985). Which you will pretty much never see anyone do.
- throwawayffffas 4y agoIn my example you would not actually write it out but instead have something like this. [sin(x) for x in sample] My point is that the trig functions are abstract and useful in multiple domains and in most of these domains turns does not make sense. Turns only makes sense in geometry and maybe some physics but most of the time in these cases you might be better off working with other units, like say quaternions. The fact is in the vast majority of literature trig functions take rads as arguments, it's the sane default for that reason alone.
- throwawayffffas 4y agoTo clarify my objection is with this statement > no one ever writes down numbers in the unit of radians, they already convert to half rotations or full rotations by scaling with pi That statement is true only if you are talking about geometry, If you are working in any other domain the trigonometric functions operate on real numbers and have nothing to with rotations or angles and if I call sin(1) I expect to get back 0.7847 not 0
- sbaiddn 4y agoSaying "rad" are bad units for sin is like saying e is a bad base for logarithms. The only "bad" thing about rads is that they're not taught early enough so that culturally 45 degrees are not know as pi/4. Then a turn would be known as simply as 2pi (or "a one eighty" as Americans infuriatingly like to call it when someone rotates 360 about themselves)
- estomagordo 4y agoHmm. I don't think I have ever witnessed someone describe a full rotation as a one eighty.
- falcor84 4y agoI'm actually more familiar with the reverse mistake, when people say someone "did a full 360" to mean they have changed their mind/approach. I suppose the confusion there is with the association of "full 360" with "comprehensive" (as in looking all around, without any blind spots), which is valid.
- zardo 4y ago> (or "a one eighty" as Americans infuriatingly like to call it when someone rotates 360 about themselves) I've never heard of this. Even if you fail math, you'll know this from playing Tony Hawk Pro Skater.
- masdani233 4y ago[dead]
- deleted 4y ago[deleted]
- PaulHoule 4y agoIf you like turns you might like https://en.wikipedia.org/wiki/Gradian https://en.wikipedia.org/wiki/Gradian which is ¼₀₀ of a turn. I guess the metric way to do it is use centiturns (4 gradians), milliturns, etc. On the other hand if you like metric and radians you might like https://en.wikipedia.org/wiki/Milliradian https://en.wikipedia.org/wiki/Milliradian
- chrismorgan 4y ago> ¼₀₀ {vulgar fraction one quarter}{subscript zero}{subscript zero} is the wrong way of writing this, generally producing a suboptimal result (denominators and subscripts occupy different lines, and the known fractions often have slightly different, more manually-optimised layouts anyway). The proper way is {digit one}{fraction slash}{digit four}{digit zero}{digit zero}: 1⁄400. Won’t render looking like a fraction with split numerator and denominator in all fonts, but it should mostly look better.
- chobytes 4y agoOof. This is one of those not-even-wrong cases in which the misunderstanding is revealing. Math education is so lacking among people who could really benefit from understanding it. Sad state of affairs.
- joelgibson 4y agoThere are a lot of comments here saying that radians are the only true way to deal with angles, however I agree with the author of the original article that turns are a legitimate alternative - I just wouldn't use the same language. Instead I would say that the new function I'm calculating is sin(2π t), and maybe also say that t is measured in turns, where (1 turn) = (2π rad). It still has a nice small angle approximation: sin(2π t) ≈ 2π t for small t (arguably this is easier to interpret than sin(x) ≈ x), and its derivative is slightly more complicated: d/dt sin(2π t) = 2π cos(2π t). But everything is still perfectly workable and makes sense. I don't think you would find a mathematician or engineer surprised to come across functions such as these. (They may prefer to make the standard [1] substitution ω = 2πt if there is going to be a lot of differentiation involved, but this is a choice, not a requirement). Turns can also be helpful as an intermediate unit which is to be translated both to an angle, and something else (colour, pitch, etc). I used turns internally for a pitch pipe application [2], where a turn became both an angle around a circle (t ↦ (cos(2πt), sin(2πt)), and a pitch moving up and down in equal temperament (t ↦ C4_FREQUENCY * 2^t). That way t=1.5 means either 1.5 octaves higher, or 1.5 full turns around the circle. What mathematicians or engineers would be unhappy with is finding a redefinition of sin(t) to sin(2π t). Instead, lean into the fact that algebra can be a compact and unambiguous method of communication, and make a new library function called sin2π or something, and document that it calculates sin(2π t). Everyone will know what you mean. [1]: https://en.wikipedia.org/wiki/Angular_frequency https://en.wikipedia.org/wiki/Angular_frequency [2]: https://www.jgibson.id.au/blog/pitch-pipe/ https://www.jgibson.id.au/blog/pitch-pipe/
- singularity2001 4y agothat's a nice naming convention too, everyone understands that calling sin2π(x) = sin(2π * x)
- xpe 4y agoI appreciate the article encouraging programmers to think about API design. At the same time, I look forward to a future (or present?) where compilers and static analysis tools can point out examples like this; e.g, many examples of calling code multiplying by pi followed by function code dividing by pi. P.S. This reminds me somewhat of the Department of Redundancy Department.
- evanmoran 4y agoRadians are just half-turns, so we use turns either way. Some equations look better in turns and some in half-turns, but the math works fine either way. Instead to decide which is better think of how a new student might learn this intuitively: How far around is it? 2.5 turns. This is so much clearer than 5.0 half-turns. Turns a more clear. No one
- gspr 4y ago> Radians are just half-turns, so we use turns either way. What? This thread is full of weird statements, but this one is among the weirdest. In what way is a radian a half-turn?
- tsimionescu 4y agoNo, radians are pi * half-turns. For example, a 90 degree angle is a quarter-turn (1/4 turns) or pi/2 radians. It is most definitely not 1/2 radians. Equivalently, radians can be said to represent tau turns: 1/4 turns is tau/4 radians.
- deleted 4y ago[deleted]
- adtac 4y agoIn just 24 hours, HN has redefined the units of time [1] and space. Move fast, break things indeed. What are we disrupting next? I hear the Euro is facing some stability issues. [1] https://news.ycombinator.com/item?id=32975173 https://news.ycombinator.com/item?id=32975173
- woevdbz 4y agoA motivation seems to be performance (avoiding useless multiplications followed by divisions by the same factor). I'm not sure that you really "pay" for these multiplications, with code optimization?
- munificent 4y agoI strongly suspect that in most cases, yes, you do. The only time you wouldn't pay this cost is if the multiplication outside of the sin() call and the multiplication inside of it can be constant folded together. That requires the call to sin() to have its code inlined at the callsite. Given how large most sin() implementations are, I would be fairly surprised if it does get inlined. The only way to answer this is to profile it and see.
- deleted 4y ago[deleted]
- garaetjjte 4y agoEven if it was inlined, I don't think compiler is allowed to rearrange floating-point calculations without -ffast-math or other scary flags.
- bhk 4y agoThe author makes the point that turns allow for exact representation of many commonly used angles, but with binary floating point, many common angles (1/6 of a turn, for example) are inexact. This could be addressed by using a whole number other than 1 to represent a turn ... one that is a multiple of 3 (or 3x3) and 5, and while we're at it, 2 (or 2x2x2), so most commonly-used angles are whole numbers! That gives us 360 as the value representing a whole turn.
- lupire 4y agoThere's no need to represent fractions of a turn as binary fractions, since you don't ever need more than 1 turn. You can represent fractions of a turn as (pair of integer) rationals, and round on the rare occasion that the denominator gets too big.
- aaaaaaaaaaab 4y ago>since you don't ever need more than 1 turn Helix.
- EmilioMartinez 4y ago>1/6 of a turn is inexact I just want to point out that that is an issue with radians too (pi/3). Whenever this happens I just use that same integer representation (or rational as some poster said) and then remember to multiply by tau before using a math library. With a turns-based library it would only make my life (very slightly) easier
- ambyra 4y agoI use vectors for everything in game programming. If I want to rotate something, Unity has this: transform.rotation = Quaternion.LookRotation(directionVector); I never touch sin, cos, pi. When I see a sin function in someone's code, my first instinct is that they're doing something wrong.
- cvoss 4y agoThe abstraction Unity provides allows you to do neat things without fully understanding the math behind it. But if you don't also learn the math, now you are limited by what those abstractions allow you to do and by the performance cost due to the fact that these abtractions can't make good use of special-case information that would be available to you if you handcrafted the operation. It is perfectly legitimate to rely on abstractions a lot of the time because it's safe and easy, and _also_ want to roll your own manipulations sometimes, because 1) when you're accustomed to solving weird trig problems with trig, that's the most straightforward way to write the code, or 2) for performance, which, for a game developer, I think ought to be a major concern.
- roywiggins 4y agoIt's super common for people to reach for trig to solve geometry problems when they should be using vector arithmetic instead, eg this answer on SO has to special-case vertical/horizontal lines, which can be avoided entirely if it didn't reach for trig in the first place. https://stackoverflow.com/a/63673261 https://stackoverflow.com/a/63673261 I think this is the sort of situation that GP is referring to.
- morelisp 4y agoA lot of people are getting hung up on the "math never decreed" sentence (not entirely wrongly since it's basically false, and surprising for Casey who has probably forgotten more linalg than I'll ever know), but that's not really the point of the article. The point is that notationally, turns seem to read better in most code that isn't doing analysis. I'd say this points more to a flaw in our languages than in our function definitions. Of the major general-purpose languages I think only C++ has really taken a shot at implicit unit conversion, which would let you safely and correctly sum a `turn facing` and `degrees delta` and pass the result to a `float sin(radian x)` function and statically ensuring your dimensions remain correct. Everything else I can think of either makes newtypes too complicated to define, lacks conversion overloads (or more likely lacks operator overloads entirely), or refuses to let you do them implicitly. C++'s approach is certainly too general, but is it really impossible to corral such behavior in a way that's both safe and convenient?
- shadowgovt 4y agoI think this whole comment thread is missing the forest for the trees. The forest here is: know what abstractions your dependencies use and be ready to break your own when you need more speed. This is a vital skill for game developers, where every cycle tends to matter.
- renewiltord 4y agoIt definitely makes sense to make computer-trig functions that operate in the [0,1] scaled version of [0,tau]. More efficient.
- armchairhacker 4y agoBetter than turns, radians, etc. is an `Angle` newtype AKA wrapper class. It completely eliminates misinterpretation of the value, miscalculation from [angle = angle + tau*n] as all angles are normalized, is more descriptive, and in a decent language is zero-cost. Programmers should not be using (radians: float) in modern languages which support wrapper classes
- tsimionescu 4y agoThis has nothing to do with the article, and it is equally applicable to degrees, radians, or turns. It neither solves nor hinders the simplicity or performance issues the article was talking about.
- londons_explore 4y agoI disagree. By wrapping an angle in an Angle class, the internal representation need never be exposed to the programmer. Rather than every programmer needing to read this blog post to see the performance benefits of using 'turns', instead now just a few library developers need to.
- tsimionescu 4y agoTypes are just labels applied to variables. Their only power is type-checking a program to see whether every variable use is consistent. Wrapping something in a type doesn't magically change its value. Not to mention, Angle is a particularly poor name, since radians, degrees and turns are all different measures of angles. Say I have this program: x : Angle = 90 y : Angle = pi/4 z : Angle = 1/4 sin : Angle -> Real sin x //what will this print? sin y //how about this? sin z // ?
- kadoban 4y ago> Wrapping something in a type doesn't magically change its value. It changes its meaning and operations. `x : Angle = 90` and friends should just be illegal. `x : Angle = Degrees(90)` is better. Then the programmer can use whatever is convenient.
- kazinator 4y ago> But math never decreed that sine and cosine have to take radian arguments! That is not entirely true. It comes from the relationship between those functions and the complex numbers via the Euler formula. ix e = cos x + i sin x There may be arithmetic/numerical inconveniences, but that's not all there is to "math". Let's define ncos and nsin ("nice cos, nice sin") as follows: nsin x = sin 2πx ncos x = cos 2πx So then what do we make of: ncos x + i nsin x This has to be cos 2πx + i sin 2πx which is then 2πix ( 2π) ix ix e = ( e ) = f 2π Where f = e is a weird number like 535.4916. This f doesn't have nice properties. E.g.: d x x - f /= f dx Otherwise it works; for instance 90 degrees is 0.25 and surely enough 0.25i f = i In situations not involving e in relation to angular representations via Euler, f cannot replace e. I'm all for having parallel trig functions in libraries that work with turns, though. The annoying 2π factor shows up in lots of places though. Should way, say, in electronics, redefine a new version of capacitive reactance which doesn't have 2πf in the denominator, but only f?
- jVinc 4y agoI see where you're coming from, if the formulas end up having weird numbers like 535.4916 or numbers like 2.718 or 6.28318 then obviously there's something suspicious about the equation. But small correction though. You got the number wrong, it's actually much more weird than any of those mentioned. The actual equation you come to for ncos an nsin is: (-1)^(2x) = ncos(x) + i nsin(x) And yes, -1 is a very weird number. If you take it to the power of something divisible by 2 you get itself raised to zero. What's up with this spooky periodicity? Also if you have x=1/4, then we get weird numbers like sqrt(-1) what on earth is that all about? No way that will fly, no way. No I'll take my 2.718^((-1)^(1/2)) and multiply through with 6.28318 that way I don't have to bother understanding what I'm doing I can sleep comfortable at night knowing that someone else has done all the thinking that needs to be done on the matter, and that turns or rotations are a blasphemous concept that breaks the very concept of math through scaling of an axis. You'd think math was strong enough to withstand such a minor change, but the textbooks do not mention it thus it must not be contemplated!
- wyager 4y agoWho cares? It doesn't matter. No one doing serious work in physics, simulation, etc cares about units at all besides very broad distinctions between systems like natural units vs constructed. Arguing about imperial, metric, pi, tau, etc is 99% bikeshedding by people who don't even do this stuff. > But math never decreed that sine and cosine have to take radian arguments Yes it did. The lowest kolmogorov complexity definitions of all trigonometric functions (free from non-integer constants) all take radian-based arguments.
- WillPostForFood 4y agoOoof, you're no true scotsmanning with that bikeshedding argument. No one doing serious work in physics, simulation Well, he is doing game engines, so you are right, it is not about "serious work in physics, simulation", it is about simplicity and performance in games.
- NaturalPhallacy 4y ago>which means the calling code is multiplying by a factor of pi just so the library code can immediately divide it back out again. Mathematical philosophy aside, that's a pretty compelling argument from a practical perspective. You're doing two unnecessary relatively expensive (multiply/divide) operations in a process that's supposed to be fast.
- rkagerer 4y agoIn practice how likely is it the compiler will optimize away the redundant operations? Is the library boundary typically a barrier to optimization?
- NaturalPhallacy 4y agoIf the compiler isn't compiling the library too, I would assume yes.
- dublin 4y agoBravo! Bravo!! Now if we can just make base10 math the default in modern languages and only let the very few propeller headed weenies that really need it ever pay attention to floating point math and IEEE-754 Hell, we can join the 21st century we were promised. (Oh, where's my flying car, dammit?!)
- zokier 4y agoIEEE 754 has had decimal (base10) math for close to 15 years now.
- meshaneian 4y agoTIL that the uncanny valley can apply to mathematics.
- pmayrgundter 4y agoτ >> π
- hoosieree 4y ago"Turn-based game" gets a new meaning.
- SideQuark 4y agoLots of things work better in radians: s=r * theta, area = 1/2 theta^2 * r, d(sin(x))/dx = cos(x) (etc, for slopes and numerical algorithms), simpler series approximations and algorithms for computing these and other functions, movement rates of things using gears or wheels are simpler to calculate, radians are dimensionless whereas anything else is not (when used in nearly any physics or math uses), hardware support for lots of related functions, interoperability with legions of existing software, papers, book, and algorithms...
- cb321 4y agoI am a bit surprised with all this commentary that no one has yet mentioned the two variants of Planck's constant - the original one in terms of cycles (turns, here) and the hBar=h/(2pi) that winds up being more common. Questions like this ultimately have answers related to what formulas are most often deployed - more a sociological question than anything else.
- singularity2001 4y agoIn Julia multiple dispatch you could just call sin(3 turns) which would dispatch the unit to the optimized nsin. Would the compiler optimize it to be overhead free though?
- ChrisRackauckas 4y agoYes, it would devirtualize the dispatches for that kind of thing at compile time if the argument type is known at compile time. See how Unitful.jl works. You can then see inside of the LLVM and native code that it swaps in the required functions.
- hddqsb 4y ago> But math never decreed that sine and cosine have to take radian arguments! To quote a really important comment posted by Eduardo Vasquez on the article: > [...] all those formulas of derivatives and primitives of trig functions in standard calculus books assume that arguments are expressed in radians. Say, the derivative of sin(x) w.r.t. x is cos(x) --- that is only true if x is in radians. Otherwise, you would get an extra factor, due to the chain rule. [...] (There are a few comments here that point this out, but they are nested pretty deep so I thought it was worth repeating.)
- Aardappel 4y agoWhat is the radius of a circle that has a circumference of 1 (as proposed in TFA)? It is 0.5/PI == ~0.15915, which means you are just moving the "problem" elsewhere. I am sure there's a lot of math that is simpler with radius being 1.0 (with some input in radians) vs an input in "turns" and having to deal with a 0.15915 radius. Yes, agree turns would be so much nicer for many use cases, but I'd like to see which operations it makes worse first :) If indeed almost every hardware/library implementation of `sin` would lose a multiply by an arbitrary constant by choosing a new input scale, that would convince me too, as long as it was the same scale for all.
- EmilioMartinez 4y agoBut the proposal here would not change the circumference to 1, it's about representing angles in another currency. More often that not when you are doing trigonometry you care more about angles than arclength. The issue stems from thinking angles in terms of arc length.
- Aardappel 4y agoThe angle needing to be used as a length (to be able to use the same scale as a unit radius) is something that naturally happens in a lot of trig algorithms. It depends whether you care more about the "UI" (the user of the algorithm gets a more pleasant input range to use) vs how convoluted the implementation is (somewhere deep down an extra multiply by 0.15915 was needed). All I am saying that "turns" are not universally better, they have downsides too.
- diedyesterday 4y agoPi and radians mostly and naturally enter math when we are dealing with both angles and radial distances (e.g. in spherical coordinates). If we choose to normalize in terms of "turns", then angles and circumferences may look natural but radial distances acquire Pi's everywhere.
- QuantumED 4y agoSee:https://doi.org/10.1088/1681-7575/ac7bc2 https://doi.org/10.1088/1681-7575/ac7bc2