So how does your computer ACTUALLY compute sine? Basics of trig and more…

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 ก.ย. 2024
  • What is sin/cos/tan really? How do they relate to the dot product? How are they even computed by your hardware?
    My Courses: simondev.teach...
    Support me on Patreon: / simondevyt
    Follow me on:
    Twitter: / iced_coffee_dev
    Instagram: / beer_and_code
    Trigonometry is often cited as an are of math for game development. In this video, I explore trig functions a bit, what they actually compute for you in a visual way, and tie that together with basic linear algebra. Lastly, we explore how these functions are actually computed under the surface.
    Intel Paper: citeseerx.ist....
    Robin Green's Blog: basesandframes...

ความคิดเห็น • 573

  • @simondev758
    @simondev758  ปีที่แล้ว +54

    Patrons can now vote for the next video! Thank you for your support.
    ❤ Support me on Patreon: www.patreon.com/simondevyt
    🌍 Live Demo + Courses: simondev.io

    • @mathmachine4266
      @mathmachine4266 ปีที่แล้ว

      I actually had to write my own sine function for the BigDecimal class in Java, which is used to represent floating points with a variable amount of precision. It already had addition, subtraction, multiplication, division, integer powers, and on Java 9+, square roots. But it didn't have transcendental functions, so I had to code those in manually.
      My method was first to calculate π to the specified precision, using some method with cubic convergence that I forgot the name of. It then stores π in a hash table which correlates numbers of digits to approximations of π, so we don't have to recalculate π every time for trig functions of the same precision.
      After this, I perform range reduction, like you said. Although in this case, I actually limit the range to (-π/2,π/2], since as you'll see later, my approximation is an odd function and has the same precision for x as it does -x. After that, I acknowledge the fact that angle duplication, triplication, quadruplication, etc formulas exist, and since BigDecimal stores everything in decimal, I figured it'd be trivial to simply multiply the angle by 0.2, calculate the sine, then apply an angle quintuplification formula at the end. Now our range of calculation has been reduced to (-π/10,π/10]. I then tell it to calculate the sine of our 1/5 angle using a certain number of iterations of the Taylor's series, the number depending on how many digits we have, then apply the quintuplification formula, and we're done. The cosine is calculated in a similar way. Luckily, multiplying an angle by an odd number does not require knowing the other number. That is, knowing the sine of nx does not require knowing the cosine of x, and knowing the cosine of nx does not require knowing the sine of x. Furthermore, it's easy to find how many iterations you need, since π/10 ≈ √(1/10) (slightly less, actually), and n! goes up super-exponentially, so worst case, your Taylor series adds slightly more than 1 digit each time.

    • @dalegriffiths3628
      @dalegriffiths3628 ปีที่แล้ว +1

      Sorry I missed this Simon - I do follow your channel and would have probably gone with this … I’ve already bought ThreeJS journey by Simon Bruno so can’t really afford yours as well but let’s hope there’s another discount in the future?

    • @leif1075
      @leif1075 ปีที่แล้ว +1

      But what you did IS A REAL MATH PROOF..just a visual geometric one..see what I mean?

  • @kangalio
    @kangalio ปีที่แล้ว +1477

    Yeah, a circle was what I taught myself what sin and cos were about when programming in Scratch as a child. And when school started explaining sin and cos with triangles I was like "huh?"

    • @simondev758
      @simondev758  ปีที่แล้ว +414

      No idea why all the love for the triangle version, feels unintuitive

    • @Afreshio
      @Afreshio ปีที่แล้ว +57

      @@simondev758 i've heard trig favores triangles in Comp graphics because 3D graphics are made of tiny triangles or something like that

    • @kangalio
      @kangalio ปีที่แล้ว +147

      @@Afreshio That seems weird, the triangles in computer programming are not necessarily right triangles, which is a prerequisite for the definition of sin/cos/tan

    • @Playerofakind
      @Playerofakind ปีที่แล้ว +15

      @@simondev758 it's easier to show and follow as people are more familiar with basic shapes lile right triangles

    • @2fifty533
      @2fifty533 ปีที่แล้ว +6

      @@Afreshio thats not true at all

  • @swolfington
    @swolfington ปีที่แล้ว +625

    As someone learning game programming with almost zero useful formal mathematical education (through no ones fault other than my own - I was just a terrible math student), this was really accessible. Thank you for taking the time to put this stuff together in such a nice format.

    • @jacobfield3951
      @jacobfield3951 ปีที่แล้ว +13

      I feel you. I jumped In hard into wanting to learn machine learning. The grind is real

    • @richie61745
      @richie61745 ปีที่แล้ว +11

      Game math isn't as bad as the stuff they teach in school -- since it's visualized and meaningful. Of course it's still difficult, but knowing what a dot product is is a lot better than solving a dot product on paper. Same with cross and all that. You mainly just need to know what the functions do. It does help if you understand how to read math notation and even better if you know the little tricks of everything like a mathematician so you can figure out solutions to problems that other people haven't encountered or find ways to optimize certain things. I used to be an F student for my whole life, but found after learning math through games that I am very good at it and even decided to take some classes and got great grades. With classes there is a ton of memorization and formulas, and you have to know the basics extremely well.
      Good luck though, game programming is very difficult. And debugging and testing are a lot harder in game dev than most other types of software dev

    • @yassinesafraoui
      @yassinesafraoui ปีที่แล้ว +3

      Having been a bad math student isn't the end, you can still improve through TH-cam vids and stuff, in fact, you can be pretty good at math and not score well in exams, this was a common issue I had. So don't say it's over

    • @YonDivi
      @YonDivi ปีที่แล้ว +3

      It's so strange to hear someone admit to doing bad at maths online. First thing people do online is usually is blame literally everything except themselves lol

    • @tomsterbg8130
      @tomsterbg8130 ปีที่แล้ว +2

      I've listened while school was teaching math and still find youtube to be much better at making me actually understand the subject.

  • @orangenostril
    @orangenostril ปีที่แล้ว +135

    In defense of the triangle, everything with the unit circle is literally just an application of the triangle! And in my opinion the most intuitive explanation of the weird tan graph actually comes from looking at the triangle: since tan is opp/adj, what happens when the adjacent side gets shorter and shorter? The output is going to get bigger and bigger until you get ridiculously big numbers (ie: 10/1=10, 10/0.00001=100000, 10/0.00000000001=100000000000, etc.), then when the length adjacent side is 0...
    (Also, quick correction at 4:47, the visuals for the Bhaskara I's Approximation show it matching for [0,2π], though it actually breaks off pretty soon after π.)

    • @simondev758
      @simondev758  ปีที่แล้ว +29

      Yeah, even just slightly different presentations can make a huge different people.
      Oops, my bad, I thought I drew it on 0, 2pi but said the range was only 0, pi, lemme go back and check.

  • @rarebeeph1783
    @rarebeeph1783 ปีที่แล้ว +313

    Tangent is very useful for converting angles to slopes. Tangent of an angle is literally precisely the slope of any line with that angle from +x.

    • @TorutheRedFox
      @TorutheRedFox ปีที่แล้ว +6

      i use inverse tan and then cos and sin to find points on lines given the slope but not the line equation

    • @Roxor128
      @Roxor128 ปีที่แล้ว +9

      Inverse-tangent is part of the formula for angular size. theta = 2*atan((r/2)/d), where r is the radius of the object and d is the distance to it. Something you'll need to approximate if you want to do sprites in 3D.

    • @jemmerl
      @jemmerl ปีที่แล้ว +9

      Oh my gosh. That is why they are both respectively called TANGENT. How have I NEVER put two and two together until now

    • @MikhailFederov
      @MikhailFederov 10 หลายเดือนก่อน +6

      Indeed. It’s been hiding in plain sight since algebra. “rise over run”

    • @peterpumpkineater6928
      @peterpumpkineater6928 7 หลายเดือนก่อน +2

      Yeah slope is just hight over distance. Sin over cos

  • @spore124
    @spore124 ปีที่แล้ว +169

    Very good video. I appreciated the part where you show how the symmetries of the sine function can lead to very efficient and accurate Taylor expansion computations.
    A note I will make is while a circle can be divided into any number of parts, the choice of 360 wasn't completely arbitrary historically. 360 is a highly composite number, that is it has more factors than any number before it. You can easily divide it by 2, 3, 4, 5, 6, 8, ,12 ,30, 60, 120... (there are several more). It's easy to imagine why this was useful for say, cartographers and navigators trying to make easy shortcuts for computing angles.

    • @andrewkarsten5268
      @andrewkarsten5268 ปีที่แล้ว +9

      It is mathematically arbitrary, as it is not more valid than any other number in any true mathematical sense. It makes things nicer for us, and the way we represent things with our symbols. Just like how we use base ten number system, as opposed to any other base for our number system.

    • @Supreme_Lobster
      @Supreme_Lobster ปีที่แล้ว +26

      @@andrewkarsten5268 well, we invented math for us. It is supposed to work for us, not against us lol

    • @andrewkarsten5268
      @andrewkarsten5268 ปีที่แล้ว +2

      @@Supreme_Lobster we didn’t invent math, we discovered it. We invented the symbols and system we use to represent it, but the mathematical truths were not “invented.” Math is about truth. In math, what symbols or system you use has no effect on the truth. The only thing our choice has done is make things aesthetically pleasing to us given the system we already chose.

    • @orangenostril
      @orangenostril ปีที่แล้ว +22

      @@andrewkarsten5268 Okay, but you know they weren't saying we invented mathematical truths. You're being petty for the sake of it

    • @undeniablySomeGuy
      @undeniablySomeGuy ปีที่แล้ว +9

      @@andrewkarsten5268 Yeah, but you don’t realize that truth is arbitrary. If humans were to have defined math using different axioms, truth would be defined differently. Math isn’t discovered, just like language isn’t “discovered.” Just because you can use language to describe things well doesn’t mean youre “discovering” language. Math describes things better, but that doesn’t make it discovery. Humans intentionally casted off mathematical constructions and concepts that don’t end up proving to be useful, through a process of knowledge evolution. Did humans also “discover” opposable thumbs? No, they were evolved and persist because they are useful. Math looks like discovery because you only are taught about the concepts that work.

  • @Kaptime
    @Kaptime 8 หลายเดือนก่อน +20

    5:35, Recently seen this concept again in the Kaze Emanuar M64 optimization videos. Using a folded polynomial solution, with 1/8th of the sine wave to reconstruct the whole sin/cos graph.

  • @hamsterworks
    @hamsterworks ปีที่แล้ว +6

    Digital logic designer here. I use the CORDIC algorithm to calculate sine and cosines because it is simple, fast, and small (in terms of chip area) and involves only bitshifts additions and subtraction.
    You can also use it to calculate absolute magnitude of a vector, or atan2() of an x/y pair.

  • @richardericlope3341
    @richardericlope3341 ปีที่แล้ว +7

    This is one of the best videos I've seen on this topic!
    As an oldskool gamedev, the dot product, lookuptables, and quadrantifying/octantifying periodic values were very useful.
    This video just makes understanding them easier even for us retired users.
    Have you made videos on splines? I have been using both the Bezier and Catmull-Rom to do enemy patterns in SHMUPS. They're way easier to predict than using a combination of trig functions. A piece on how to derive an angle in regard to "t" as well as reparameterizing them so that points across splines are uniform in distance would be swell.
    Looking forward to your next vid!

    • @simondev758
      @simondev758  ปีที่แล้ว +3

      I love old school dev tricks, miss being around a lot of the more senior coders who had crazy stories of gamedev back in the days. Was always impressed with their breadth of knowledge, would love to hear about some of your experiences!

  • @r2in360
    @r2in360 ปีที่แล้ว +4

    Love the video. Unlike many commenters here I learned trigonometry exactly as explained in the video with a circle of radius 1. In fact trigonometry was the first time that math "clicked" for me. I guess having a good way of visualizing what is being explained helps me a ton.

  • @williamfox4235
    @williamfox4235 7 หลายเดือนก่อน +10

    I have been wondering what Sin Cos and Tan were for ages. I could never find any halfway descent explanation of what they were only that they were. Thank you immensely.

  • @bp_cherryblossomtree723
    @bp_cherryblossomtree723 ปีที่แล้ว +15

    This 5 minute of trig taught me more than my math teacher could in 6 months

  • @csaki01
    @csaki01 ปีที่แล้ว +7

    I never understood trigonometry before and even in coding all I needed to know that they make waves that I can exploit to make something move smoothly back and forth.
    But now I finally understand... until I forget again because I still won't use them to their fullest.

  • @ababcb3005
    @ababcb3005 ปีที่แล้ว +13

    I remember seeing a discussion on a game dev forum where the approach of 6:38 was used to fit a quadratic to that part of the graph, and the fit was quite good despite the simplicity. You could then use Newton's method to refine the result if you wanted more accuracy. OTOH if you're working at the hardware level, CORDIC is the usual algorithm of choice since it avoids any multiplies.

    • @lawrencedoliveiro9104
      @lawrencedoliveiro9104 ปีที่แล้ว +1

      The legendary Clive Sinclair brought out a low-cost scientific calculator in 1975, complete with log and trig functions. Somehow his engineer, Nigel Searle, was able to implement all these functions in a ROM that could only hold 320 instructions. The algorithms he came up with were a bit slower than regular CORDIC, and had lower precision, but they worked. No other product of the time could offer that kind of functionality at that price point.

    • @toasteduranium
      @toasteduranium ปีที่แล้ว

      What do OTOH and CORDIC mean?

    • @dudono1744
      @dudono1744 ปีที่แล้ว

      @@toasteduranium CORDIC seems to be an algorithm

    • @robert3116
      @robert3116 ปีที่แล้ว

      @@toasteduranium CORDIC means: coordinate rotation digital computer. If I recall correctly, it's an algorithm that iterates and only uses bit-shifts and add operations. More iterations means better approximations.

  • @DoofEvil
    @DoofEvil ปีที่แล้ว +2

    i always found it easier to view tan as the slope of the hypotenuse. it has asymptotes at pi/2 and 3pi/2 because the hypotenuse is vertical there.
    the reason the slope is equal to that length you showed is because slope is change in y over change in x, but when the radius is 1, the change in x becomes 1, so it’s just the change in y that matters. this is the length of that vertical line
    it sound strange but it you draw it all out and try to find the slope of a triangle in a circle manually and use 1 radius to be 1 unit, you’ll see it really easily. just remember to extend the hypotenuse

  • @robarons
    @robarons ปีที่แล้ว +9

    Nice video and well explained. I really like that you also showed some code.
    One thing I noticed is that in the code at 6:50 it should be “switch (quadrant)”, but I guess you added this to check whether or not we’re paying attention? 🤓

    • @johannbauer2863
      @johannbauer2863 ปีที่แล้ว

      Also shouldn't it be PI - y and not PI / 2 - y?

    • @benhetland576
      @benhetland576 ปีที่แล้ว +1

      @@johannbauer2863 I think PI/2 - y is correct, because it mirrors the y around π/2 into Q1 which sin_kinda expects.

    • @simondev758
      @simondev758  ปีที่แล้ว +1

      Sigh yes, always a mistake somewhere in the video!

  • @Chevifier
    @Chevifier ปีที่แล้ว +4

    Its funny how when you need to learn something you learn it alot easier than when youre forced to learn it. I willing learnt about the different trig functions a while back. Nice to see the OG making a vid on it😆

  • @somecreeep
    @somecreeep ปีที่แล้ว +5

    Great video! Would love to see an explanation of how logs are computed!

  • @essenceidentity
    @essenceidentity ปีที่แล้ว +6

    Thanks alot Simon!!! Sent to my friend who's stuck on same subject what a neat synchronicity 😃👍. Happy Coding

    • @simondev758
      @simondev758  ปีที่แล้ว +1

      Good luck to your friend!

    • @essenceidentity
      @essenceidentity ปีที่แล้ว +1

      @@simondev758 your most welcome!! ☺

  • @nathanhedglin931
    @nathanhedglin931 ปีที่แล้ว +7

    Thanks! Solid video as always! Can't wait for the new course

  • @mesplin3
    @mesplin3 ปีที่แล้ว +6

    Very interesting. Do you expect to make a similar video about logarithms? I'm quite curious as to how a computer computes log(x) efficiently.

    • @simondev758
      @simondev758  ปีที่แล้ว +3

      I could take a look. I believe log is covered in the paper referenced.

  • @harshans7712
    @harshans7712 ปีที่แล้ว +1

    Well this video is really intuitive and useful, people use these built in libraries directly in their code and they don't know how the background process goes, thanks a lot for this video

  • @Stuffinround
    @Stuffinround ปีที่แล้ว +4

    I didn’t know Bob from bobs burgers was teaching math now

  • @marcoottina654
    @marcoottina654 ปีที่แล้ว +1

    5:27 lovely reference!
    anyway, i do loved the whole explanation and you showing the actual code / mathematical definition

  • @DissonantSynth
    @DissonantSynth 10 หลายเดือนก่อน +2

    As a math teacher, this is a spectacular video. Awesome work.

    • @simondev758
      @simondev758  10 หลายเดือนก่อน +1

      Glad you liked it!

  • @emjizone
    @emjizone ปีที่แล้ว +1

    Thank you. This remind me that I could implement various versions of approximate sin and cos functions depending on the accuracy I need for my application, and thus get close enough results faster than when using standard sin and cos function defined by the language or the default Math library.
    Standard sin and cos function defined by the language, its standard library or the ALU are in most cases compromises that are at the same time way to slow for real time artistic applications and way to inaccurate for science research. It's good to master this so we know what we do, always do enough without overdoing.

  • @AHSEN.
    @AHSEN. ปีที่แล้ว +56

    School does everything wrong. This is a much better explanation than anything school has ever taught me. I just luckily happened to figure out these circle rules on my own when playing with code, but the school system doesn't provide the intuitive or useful explanations of math 😔

    • @roastyou666
      @roastyou666 ปีที่แล้ว +8

      Actually our school uses unit circles to show trig and their derived properties, but the last part (about LUT and approximation) is completely new to me 😮

    • @taibasarovadil
      @taibasarovadil ปีที่แล้ว +4

      Where are you from? That's what they teach in middle school in my country

    • @badgermcbadger1968
      @badgermcbadger1968 ปีที่แล้ว +3

      ​@@roastyou666 because it's taught in calculus 1 in university/college, not school

    • @szewal
      @szewal ปีที่แล้ว +2

      @@badgermcbadger1968 they didn't even teach the unit circle in my uni calc 1 because it was assumed knowledge, it definitely isn't universal

    • @roastyou666
      @roastyou666 ปีที่แล้ว

      @@badgermcbadger1968 Ah I see

  • @ithaca2076
    @ithaca2076 ปีที่แล้ว +1

    all my life ive never needed this video until literally last week this is perfect
    amazing video my friend

  • @smizmar8
    @smizmar8 ปีที่แล้ว

    This was so helpful. I don't know if I missed it, but I don't think I've ever seen tan explained like that, and I certainly had no idea why it made such weird shapes on the graph, but now it makes simple and intuitive sense, thank you!

  • @charlesmrader
    @charlesmrader ปีที่แล้ว +2

    One of the neatest tricks I ever learned was called CORDIC, which is something like Coordinate Rotation Digital Computation. It expresses an angle as sums and differences of smaller angles which are chosen so that rotation by those smaller operations are trivially simple, operations on bits. Since a rotation of the vector (1,0) can give you sine and cosine, those are easy to compute. But suppose you are given x and y and you want to compute the angle that rotates it onto sqrt(x^2+y^2) - e.g. find the angle. It's all additions and subtractions. You can also get any of the trig functions with similar tricks. If you have to build the hardware implementation of trig computations, it's really easy.

    • @simondev758
      @simondev758  ปีที่แล้ว +1

      Super neat, I'm reading a bit about it now. Any idea if modern hardware still uses CORDIC? I found references for intel using it on older generations of hardware, 486, and the paper I cited comes out in 1999.

    • @charlesmrader
      @charlesmrader ปีที่แล้ว +1

      @@simondev758 Simon, I haven't worried about that for a long time. I first learned about it when Hewlett Packard came up with a hand-held digital calculator which could do trig functions, etc. The trig functions were all base don CORDIC techniques. In those days, a hand-held calculator hadn't gotten the years of advantage of Moore's law, so things like lookup tables were pretty burdensome.

    • @kenchilton
      @kenchilton ปีที่แล้ว

      Yes, CORDIC was used on handheld calculators. It is a much friendlier way to take a small, carefully crafted lookup table and create solutions for any precision you desire.
      Modern algorithms include the Chebychev series. Taylor series are too slow to converge, so they are not used for trig functions.

  • @keionvergara7608
    @keionvergara7608 ปีที่แล้ว +1

    this video answers one of my questions i’ve been wondering for years! beautiful video

  • @monochr0m
    @monochr0m ปีที่แล้ว +5

    Just found this channel - and while I do a lot of math for a living, this was such a nice presentation that you earned a subscriber

    • @simondev758
      @simondev758  ปีที่แล้ว

      Welcome aboard!

    • @jesusandrade1378
      @jesusandrade1378 8 หลายเดือนก่อน

      Me too. And I am not a game developer, or coder, or mathematician, but I love mathematics and how it may be implemented in smart and clever algorithms

  • @fokeyjo
    @fokeyjo ปีที่แล้ว +1

    Being an old time dev, I have always worried about how sin & cos are being computed in case they are expensive, as I'd heard how early 3D engines used the lookup table approach as a speed hack. But seeing how it's done these days has set my mind at ease. Thanks! :)

  • @iamtimsson
    @iamtimsson 7 หลายเดือนก่อน +1

    this is a great video and a wonderful presendation not just due to my lack of intuitive mathematical knowledge

  • @jr01theweeb
    @jr01theweeb ปีที่แล้ว +3

    I would like to see going over modulo, since there are 2 definitions of it and different engines uses one of the two definintions.

  • @creaky2436
    @creaky2436 ปีที่แล้ว +2

    Much love Simon. I love your videos man. You’re a smart guy and elite programmer.

  • @ChookyChuck
    @ChookyChuck 4 หลายเดือนก่อน

    This brings back memories' of me being fascinated with the book "Numerical Recipes for (C, Fortran) in the 90's".

  • @ZILtoid1991
    @ZILtoid1991 ปีที่แล้ว +1

    Yamaha's FM implementation used a quarter of a sine wave (premultiplied to ease of certain other calculations) as a lookup table.

  • @giorgiobarchiesi5003
    @giorgiobarchiesi5003 7 หลายเดือนก่อน +1

    In fact you can reduce the range even further, by noticing that the sin function, for x ranging from pi/4 to pi/2 is a mirror of the cos function between 0 and pi/4. And the Taylor series in the 0 to pi/4 range converges to an optimal precision after very few terms, both for sin and cos. This is what I did, without suggestions from anyone, on my Z80, in assembly code, back in the early eighties.

  • @nobody.of.importance
    @nobody.of.importance ปีที่แล้ว +1

    I've been working on low level graphics functions for some ten years now and it blows me away how bad people are at explaining trig functions. You, my dude, have nailed it. The unit circle is easily the best way to visualize how they work. Looking forward to see how you simplify matrices and quaternions, assuming you'll be doing those. The best way I've found *personally* to represent the former is using basis vectors and showing how it's like a box within a box within a box, if that makes sense. The latter's a bit trickier, but I usually imagine it as a ray emitted from a given point, with everything rotated a given number of radians around that ray.
    Hope this channel grows. I'll do my part. :p

    • @simondev758
      @simondev758  ปีที่แล้ว +1

      Definitely, basis vectors are THE way to go for matrices. You can even simplify multiplication that way.

    • @nobody.of.importance
      @nobody.of.importance ปีที่แล้ว +1

      @@simondev758 Heck yeah, my dude. Lookin forward to the videos when they come out!

  • @LukeAps
    @LukeAps ปีที่แล้ว +1

    Well. Damn. That was a very educational visualization of SinCosTan. Especially the movement to graph. Thank you.

  • @Wobling
    @Wobling ปีที่แล้ว +2

    I look forward to picking up the math course!

  • @thomasrosebrough9062
    @thomasrosebrough9062 ปีที่แล้ว +2

    Never for a millisecond even questioned the ability for a computer to calculate sin(x) with perfect accuracy until I saw this thumbnail
    Then you explained how some games and stuff approximate it for speed, but now I'm realizing even on a *supercomputer* we've *never* been able to perfectly calculate sin(x), because it's a function based on π, an irrational number of infinite length which can't be represented in a computer. This existential crisis quickly led to another, realizing that we *will never be able to perfectly represent sin or any trig function because pi goes on forever, and that in a sense ALL of the maths we do, both on the computer and off, is like this: only theoretical on nature and every actual calculated number we use is just an approximation of some unobtainable truth of the universe and...*
    I think I need a drink

    • @simondev758
      @simondev758  ปีที่แล้ว

      This got deep, quickly

    • @jesusandrade1378
      @jesusandrade1378 8 หลายเดือนก่อน

      But the grat benefit of these algorithms and formulas ( Baskhara, CORDIC, Chevyshev, etc.) Is that you use only the precision that you need.
      And talking about precision, there are fórmulas with very fast convergence for computing billions and trillions of digits of π (I forgot the Authors of the paper from 2004 or 2008) that even can compute segments of digits (for example between 1 million to 10 million, or between 1 billion and 10 billion, etc,) without even computing the precedent digits. They say the techniques used to get those fórmulas come from INTERVAL ARITHMETIC.

  • @jesusandrade1378
    @jesusandrade1378 8 หลายเดือนก่อน

    After reading many comments here by different persons, i collected a brief summary about the algorithm CORDIC (not the algorithm itself):
    X
    The CORDIC algorithm was used to compute Trig functions in hand-held calculators (HP and others), and computers with slow processors and small memory, but is specially useful for implementation in hardware as bit-shift operations and additions and substractions, which is very easy. You can also use CORDIC to compute the absolute value of a vector, and the function atan2() of any pair of x/y .
    The Baskhara Approximation formula can be used to compute sin(x), too (but maybe with less precision).
    A more modern algorithm than CORDIC ( and vastly superior, they say) uses Chevysev Series (or Approximation).
    Taylor series are very slow to converge, so they are not used to compute Trig functions.

  • @kingbeauregard
    @kingbeauregard ปีที่แล้ว +25

    I've fiddled around with approximating sines and cosines. I like the idea of reducing things to the range from 0 to pi/2. One more step, I've found, is to care only about the range from 0 to pi/4. What happens from pi/4 to pi/2? Well, that'd be the complementary function of the complementary angle. Like, the sine of 80 degrees would be the same as the cosine of 10 degrees. Polynomial expansions close to zero tend to get very accurately very quickly.
    So that region around pi/4 (45 degrees) is where things would converge the slowest, but even then, I think we've got an approach for that. Remember that sin(a - b)= sina*cosb + cosa*sinb, so if you wanted to calculate the sine of 40 degrees, that's the sine of (45 - 5) degrees. Okay then, so we'd have to calculate sin(45)*cos(5) - cos(45)*sin(5), and sin(45) = cos(45) = 0.7071etc, so we've got very little to calculate. The answer will be 0.7071etc*(cos(5) - sin(5)), and those will converge quickly. At this point we're approximating just from 0 to pi/8.

    • @tormodhag6824
      @tormodhag6824 ปีที่แล้ว +1

      Good stuff

    • @kingbeauregard
      @kingbeauregard ปีที่แล้ว +3

      Okay, I did some more mathing on this. If we take the measures as described above, the most error-prone calculation we could perform is cos(pi/8); and yet, even at three Taylor terms (1 - x^2/2 + x^4/24), the error is only 0.00000508. That's 5 parts per million. Add a fourth term (-x^6/720) and the error drops to 0.000000014, which is 14 parts per billion. And that's the worst case scenario: this converges to a reliable value pretty fast.
      I imagine a person could keep going with this basic approach, where one reckons against angles with known values, and thus has to Taylor Expand against only an offset. If we reckon against pi/16, even three terms will get us to an error of 80 parts per billion. (A fourth term will take us to 55 parts per trillion. Holy smokes, that's got to be accurate enough for essentially every purpose.)

    • @meandyours
      @meandyours ปีที่แล้ว +2

      @@kingbeauregard correct me if I'm wrong but, if I understand floating point numbers correctly, to be as precise as can be for a float (32 bit with 24 significant bit), you need the error to be less than 1/2^24 (~0.0000000596), and for a double (64 bit with 53 significant bit) 1/2^53 (~0.00 000 000 000 000 0111).

    • @kingbeauregard
      @kingbeauregard ปีที่แล้ว +2

      @@meandyours I don't really know how floating point numbers are represented internally. I guess that the degree of precision required is dependent upon the application.
      I do know this much though (and, arguably, not much more). Let's say you were trying to figure out the deviation between two functions and there was some trig involved, and the differences would be small, like in the "thousandth of a percent" range. The smart approach would be to do Taylor Series of the two functions and then subtract one series from the other; you'd probably find that most of the initial terms would go away altogether, and you'd be left with terms that start at the order of magnitude that matters.

    • @meandyours
      @meandyours ปีที่แล้ว +1

      @@kingbeauregard Basically, a floating point number is represented in scientific notion, except in binary. The significant bit (binary digit) is the equivalent to the significant digit of a scientific notation. However, a floating point number can only be so precise as its size is limited, that's what I mean on the precision needed, as anymore wouldn't be representable
      sry, i was looking at this more from the computer science angle

  • @jesusandrade1378
    @jesusandrade1378 8 หลายเดือนก่อน

    I think with the unit circle and using more lines you can also visualize COT, SEC, and CSC.
    If I am not mistaken, the unit hyperbola is used to visualize the HYPERBOLIC TRIG FUNCTIONS, Sinh, Cosh, Tanh, etc

  • @mayuukhupadhyay6845
    @mayuukhupadhyay6845 ปีที่แล้ว +3

    Could you please make a video about application of calculus in game development?

  • @oracuda
    @oracuda ปีที่แล้ว +3

    please make a video on quaternions!

  • @yolamontalvan9502
    @yolamontalvan9502 7 หลายเดือนก่อน

    Very interesting. You make it very easy to understand. Thank you. You forgot to mention the software used to make those trigonometric graphics.

  • @kaynex1039
    @kaynex1039 ปีที่แล้ว +1

    Great video, easy to learn from.
    I personally, find it much easier to see tanθ as the slope of the terminal arm. That is, once you place your θ and extend the terminal arm to the circle, the arm's rise/run is tanθ.

    • @simondev758
      @simondev758  ปีที่แล้ว

      Yeah, I feel like I should have included multiple interpretations of tan instead of settling on one.

    • @DoofEvil
      @DoofEvil ปีที่แล้ว

      it’s really the same idea though. he explained tangent as the height of the line when you connect it with the unit circle on the x-axis. this height is the rise. the unit circle, with radius 1, is the run

  • @versacebroccoli7238
    @versacebroccoli7238 ปีที่แล้ว +1

    This is the exact question I've been trying to figure out for weeks. Like what actually is in the black box of sin and cos.

  • @hamsterhaunter5718
    @hamsterhaunter5718 ปีที่แล้ว +2

    Great video! What programs did you use to make this video?

  • @morgan0
    @morgan0 ปีที่แล้ว +1

    iirc, implementations usually divide by 2pi first, so using a 0-1 range i think referred to as turns is faster

  • @idjles
    @idjles ปีที่แล้ว +1

    You can also use half angle formula to get it to small angles for the Taylor series

  • @leighhurley9410
    @leighhurley9410 6 หลายเดือนก่อน

    Brilliant video! You've answered the question in an interesting, complete and easy to follow way 😁

  • @kaiser-qe7iy
    @kaiser-qe7iy 7 หลายเดือนก่อน +1

    using euler's formula for computing sine is also possible (sin x = e^ix - e^-ix/2i).

  • @Brahvim
    @Brahvim ปีที่แล้ว +1

    Not somebody with any formal Math or CS education or anything _what-so-ever,_ but I remember reading about the use of "Chebyshev polynomials" for optimization on Stackoverflow, and how the Taylor series approximation has been rejected many times for use in, say, a standard library. Many more tricks were mentioned, and it's just a bunch of tricks about crazy/trivial micro-optimizations.
    Thoughts?

    • @simondev758
      @simondev758  ปีที่แล้ว +1

      Yeah, gave them a quickie mention in the video but didn't wanna stray too far off topic from the basics

  • @JunpilByeon
    @JunpilByeon ปีที่แล้ว +1

    Looking forward to this course

  • @Playerofakind
    @Playerofakind ปีที่แล้ว +2

    I enjoyed this video, would you consider doing one for other math concepts like matrices?

    • @simondev758
      @simondev758  ปีที่แล้ว +2

      Definitely! I have a really good idea for some other math ones. I'd also like to get into some more advanced math topic in game development like spherical harmonics.

    • @jesusandrade1378
      @jesusandrade1378 8 หลายเดือนก่อน

      Besides being a game developer, are you also a mathematician ?

  • @Ferenc-Racz
    @Ferenc-Racz ปีที่แล้ว +3

    thank you for your knowledge sharing and useful explanation. Really thank you. I wish I was teach / learn this in school, not from youtube. :(

  • @hologram1049
    @hologram1049 ปีที่แล้ว +1

    Great video as I’m going into calculus and hadn’t quite grasped the relationships and just been working out their inverses & antiderivatives & derivatives. I love a similar videos on csc, sec, and cot if your up for it

  • @jesusandrade1378
    @jesusandrade1378 8 หลายเดือนก่อน

    ​​@ThePeterDislikeShow there are mechanical computers made entirely of Mechanisms as seen in the courses of Kinematics (links, joints, cams, gears, etc.) or "Kinematics of Mechanisms" and "Dynamics of Machinery". The book by (Bela L.) Sandor of 1967 or 1968 shows a photo with the internal components already assembled. This mechanical computer can even do integration (and I think differentiation, too)

  • @Engoneer
    @Engoneer ปีที่แล้ว +1

    i had a conversation with my math teacher about trying to understand what the sin/cos function really is, he had no clue lol

  • @nikbivation
    @nikbivation ปีที่แล้ว +1

    Exactly what I needed! Thank you!

  • @davidgillies620
    @davidgillies620 ปีที่แล้ว +1

    I used scaling and symmetry with lookup tables and interpolation to do trig on my Commodore 64 in the 80s. There were, of course, no floating point instructions for the 6510 so it was some fairly gnarly bit munging in assembler. Commodore BASIC had trig support but sometimes you needed the extra 26K of RAM.

    • @simondev758
      @simondev758  ปีที่แล้ว

      I always feel like I missed on, starting my career well after the days of people hand writing assembly stuff and knowing the hardware so thoroughly

  • @6ocram
    @6ocram ปีที่แล้ว

    Looking forward for the "Game Math Explained Simply" course. Your explain thing really well :D

  • @josephl2027
    @josephl2027 ปีที่แล้ว +1

    fantastic explination!

  • @ThePhysicsTrain
    @ThePhysicsTrain ปีที่แล้ว +1

    Very beautiful animation..

  • @SpencerNold
    @SpencerNold 7 หลายเดือนก่อน +2

    Honestly, I always just assumed computers just did Taylor series, and never thought more into it

  • @ke9tv
    @ke9tv ปีที่แล้ว +1

    Circular functions are just as likely to be implemented using CORDIC as using polynomial approximations, particularly if your computer is a small core on an FPGA or otherwise lacks a fast multiply. If you don't know about CORDIC, you might want to use your favorite search engine; it's pretty clever.
    What do you get if you cross an elephant with a mouse? ||Elephant|| ||mouse|| sin theta.
    What do you get if you cross an elephant with a mountain climber? You can't do that, a mountain climber is a scaler.

  • @Zerspell
    @Zerspell ปีที่แล้ว +2

    I really enjoy watching your videos, what animation software do you use?

    • @simondev758
      @simondev758  ปีที่แล้ว +2

      I don't use any software, everything is defined mathematically in shaders. The entire video is one long shader.

    • @MixMastaCopyCat
      @MixMastaCopyCat ปีที่แล้ว

      @@simondev758 That's awesome

  • @ArachnidAbby
    @ArachnidAbby ปีที่แล้ว +2

    Making a math libraru for my programming language. I hope i can use this video

  • @HarshColby
    @HarshColby ปีที่แล้ว +1

    Very nice visualizations!

  • @hypnomn350
    @hypnomn350 ปีที่แล้ว +1

    Good video. Are you the guy from mha that hosts the provisional licensing exam?

  • @coder_rc
    @coder_rc ปีที่แล้ว +1

    Beautiful video!
    Can I know which software you use for making these videos?

    • @simondev758
      @simondev758  ปีที่แล้ว

      I write them as a giant shader and just voice over it. I have a course on shaders that covers pretty much all the concepts used to make my videos.

    • @coder_rc
      @coder_rc ปีที่แล้ว

      @@simondev758 can you link me to it?

    • @simondev758
      @simondev758  ปีที่แล้ว

      @@coder_rc simondev.teachable.com/

  • @p.j.882
    @p.j.882 ปีที่แล้ว +1

    Computer uses SERIESSUM function of a spreadsheet to generate the Taylor polynomial and graph the polynomial using LINEST functions or least squares method.

    • @simondev758
      @simondev758  ปีที่แล้ว

      Intel's dark secret, the hardware is just running excel

    • @jesusandrade1378
      @jesusandrade1378 8 หลายเดือนก่อน

      ​@@simondev758I wonder if Intel is paying royalties or is in partnership with Microsoft

  • @MaxHeep
    @MaxHeep ปีที่แล้ว +1

    quick question at timestamp 01:19 you say if we move one UNIT along the circle... a "unit" is x=0 to the edge of the circle?

  • @colin398
    @colin398 ปีที่แล้ว +1

    The taylor expansion doesnt have to be less accurate the farther you are from the origin, if you find the expansion that centered around your point of interest.

  • @Antagon666
    @Antagon666 ปีที่แล้ว +5

    Yaay new video :3
    Also nice trick is to create triangle wave using modulo (not that std crap which gives you negative signs with negative input values, just using old school floorf()).
    Then shift it, take absolute value, shift it again, so it's nice and symmetrical around the x axis, and you get a triangle wave from -pi/2 to pi/2.
    Apply minimax polynomial sine approximation to it (valid from -pi/2 to pi/2) and enjoy absolute error of 1e-7 till modulo accuracy breaks down.
    That's what I'm using in my path tracer for all transformations and sampling techniques, best thing is, you can compute sine and cosine at once using SSE/AVX, since the computation only differs at start, where x of sine function is shifted by -pi/2.
    constexpr float pi = 3.14159265358979323846;
    constexpr float pi2 = 2.0 * 3.14159265358979323846;
    constexpr float hpi = 0.5 * 3.14159265358979323846;
    float mod(float x, float y) {
    return x - y * floorf(x/y);
    }
    float fast_sin(float x)
    {
    float x2 = x * x;
    return x * (1.f + x2 * (-1.6666656684e-1f + x2 * (8.3330251389e-3f + x2 * (-1.9807418727e-4f + x2 * 2.6019030676e-6f))));
    }
    float fsin(float x)
    {
    x = mod(x - hpi, pi2);
    x = fabsf(x - pi) - hpi;
    return fast_sin(x);
    }
    float fcos(float x)
    {
    x = mod(x, pi2);
    x = fabsf(x - pi) - hpi;
    return fast_sin(x);
    }

    • @puppergump4117
      @puppergump4117 ปีที่แล้ว

      I think you missed a couple x2's down below, but it's interesting to see how closely related these functions are with things related to circles

    • @Antagon666
      @Antagon666 ปีที่แล้ว

      @@puppergump4117 You think wrong :) it's straight up taken from Godbolt, where I was testing it.

    • @puppergump4117
      @puppergump4117 ปีที่แล้ว

      @@Antagon666 Oh no I'm dumb lol

    • @simondev758
      @simondev758  ปีที่แล้ว

      Hah yes, I didn't want to get into minimax in the video though, and I didn't want a magically better version to appear suddenly unexplained, so I stuck with taylor. There's a brief throwaway comment about using minimax though.

  • @angeldude101
    @angeldude101 ปีที่แล้ว +2

    You say the triangle is useless, and then you draw the triangle on the circle and use that. The only difference between a triangle on its own, and the triangle where it belongs is that you know the hypotenuse/radius is 1, so you don't need to divide.
    The real trick is knowing that sine and cosine are incomplete on their own and each is only one half of a whole. One function for traveling along the edge of a circle, of which sine and cosine are just the two halves (x vs y, but also even vs odd parts). Usually this complete function is called the "complex exponential," but people think complex numbers are too... _complex,_ so they instead introduce this fundamental function as its two halves.
    There are also some things relating the exponential, complex as well as a few others, to generating transformations, but where the argument is the _area_ rather than the arc length.

    • @spore124
      @spore124 ปีที่แล้ว

      I had a giggle when the triangle immediately showed up in the diagram. You could say however that with the circle you get a cleaner visual interpretation of how sine, cosine, and tan represent every possible right triangle. And of course it's the springboard that then hopefully gets you to Euler's formula as you said.

    • @angeldude101
      @angeldude101 ปีที่แล้ว

      @@spore124 While it's probably harder to justify the complex exponential on its own, I'm pretty sure that if you have it, it's easier to go from that to sine and cosine than the other way around. Specifically: cos(x) = ½(exp(ix) + exp(-ix)) and sin(x) = ½(exp(ix) - exp(-ix))/i.
      These might look complicated, but they're literally just adding the mirror image and the rotated version of the function respectively. Even and odd halves. Anything that's the same when mirrored gets cancelled out in sin(x), and anything that's the same when flipped gets cancelled out in cos(x).
      The two formulas also may appear vaguely familiar if you've used _hyperbolic_ trig. cosh(x) = ½(exp(x) + exp(-x)) and sinh(x) = ½(exp(x) - exp(-x)) are the usual definitions given for the hyperbolic trig functions. They look _exactly the same_ as the circular trig functions, but without the i. sin(x) = sinh(ix)/i and cos(x) = cosh(ix). i is the fundamental constant of spherical geometry, and it has a few lesser known cousins that embody hyperbolic and flat geometry respectively, the latter of which is actually hilariously simple when plugged into the exponential.

  • @LethalChicken77
    @LethalChicken77 7 หลายเดือนก่อน +1

    Ah I remember having to code this in assembly

  • @olliecosgrove9832
    @olliecosgrove9832 7 หลายเดือนก่อน

    Didn’t even talk about CORDIC got add that beauty in

  • @syedzainulabedin93
    @syedzainulabedin93 9 หลายเดือนก่อน

    Thank you for this wonderful explanation!

  • @Inspirator_AG112
    @Inspirator_AG112 ปีที่แล้ว +2

    How about logarithms or exponents?

  • @aloluk
    @aloluk ปีที่แล้ว +1

    Smiles of happiness comes after having tankards of Ale :D.

  • @aarondavis5386
    @aarondavis5386 ปีที่แล้ว +2

    My honest feed back: the title of the video is a great hook i've long wondered how sin() is computed and the title brought me in, but shortly into the video I found myself feeling deeply frustrated feeling like more of the video was spent explaining what sin() is than how it was computed. In the long run the video left me feeling disappointed, in that I don't particularly feel any closer to understanding how sin() is computed except that someone is finally coming out and saying "it's black magic, you won't understand it"
    Going from describing the unit circle in detail, which for me was like "yeah i know what sin() is that's why i'm here move on" to mentioning a Taylor expansion, to complaints, about a taylor expansion and moving on as if the viewer should already fully grasp the full meaning of what's being said makes me think there is some question about who this video is meant for.
    At the end of the day what I'm taking away from this video is that there is Bhaskara I's Approximation which I will immediately forget the name of but knowing it's out there maybe I can find it in the future with some googling if I ever need it. Which is an equation I could implement even if I don't understand why it works. Other than that still feels like black magic.
    Also going back through the video to find the name of Bhaskara I's Approximation i noticed the futurama and HACKERS references in the code you showed this amused me greatly even though I am somewhat ashamed that I didn't catch it the first time through. Heck you'd think the old school line-numbered BASIC in the middle of a bunch of C code would've caught my eye...

    • @simondev758
      @simondev758  ปีที่แล้ว

      Great feedback, maybe I could have front loaded the intel paper a bit more instead of saving it for the end, sounds like it was too far into the video.

  • @stapler942
    @stapler942 ปีที่แล้ว +1

    That Jigsaw comment. 🤣 I wonder what level of precision he would want for a trig approximation.
    "Hello, Reginald. I want to play a game. For the past semester you have neglected your studies of series expansions by relying on Mathematica and Desmos. Inside this cabinet you will find paper and a pencil and three trig problems to solve. You will have to approximate your answers to four decimal places, within an error of..."

    • @simondev758
      @simondev758  ปีที่แล้ว +1

      You may have just invented the new edu-horror genre!

  • @anonymoussloth6687
    @anonymoussloth6687 ปีที่แล้ว +2

    How do you make your animations for your TH-cam videos?

    • @simondev758
      @simondev758  ปีที่แล้ว +1

      I do them myself using shaders!

    • @anonymoussloth6687
      @anonymoussloth6687 ปีที่แล้ว +1

      @@simondev758 i am new to this, but we can make animations like this in shaders? Do you make them in unity or some other software?

    • @simondev758
      @simondev758  ปีที่แล้ว +1

      I just write a shader, literally. No unity or anything, load it up in the browser, there's almost nothing in the shaders I do that's not covered in some fashion by my course. I also mention it somewhere on my twitter timeline, if you wanna crawl through that and find it, I provide an example of the code.

  • @crewrangergaming9582
    @crewrangergaming9582 ปีที่แล้ว +1

    my man earns a subscribe

  • @kingbeauregard
    @kingbeauregard ปีที่แล้ว +1

    Allow me to blow your mind. We all know what the Taylor Expansion of sin(x) looks like, and it comes as no surprise that sin(0) = 0, because it's 0 - 0^3/6 + 0^5/120 ... It's all zeros taken to various integer powers, so of course the sum will be zero. But consider sin(2*pi); the series still converges, and it lands on exactly 0 as it should. But what we're doing is taking integer powers of transendental numbers, and once you add them all up, they total to exactly zero. That should not be happening. That should not be possible. It is just completely counterintuitive.

  • @brucea9871
    @brucea9871 ปีที่แล้ว +2

    I'm surprised you didn't actually mention the algorithm used by computers to calculate trig (and other) functions. I have a series of videos on calculus by a math professor and he says his research involves CORDIC algorithms and those are what computers and calculators use to calculate mathematical functions. Until then I assumed Taylor's series were used but as you mentioned there is a problem with using Taylor's series (that I was previously unaware of). Moreover I think CORDIC algorithms converge faster than Taylor series.

    • @simondev758
      @simondev758  ปีที่แล้ว

      I only know a bit about cordic from reading, but I thought cordic was used on older hardware and newer stuff (hence the 1999 Intel Paper on Transcendental Functions) used the approach mentioned in the video.

    • @BoxingDayAC
      @BoxingDayAC ปีที่แล้ว

      Yeah I thought Taylor was the way until I found Chebyshev approximation with the error smoothly distributed versus expanding past the point of calculation. Chebyshev is vastly superior. Remez mins the error but you lose the smooth distribution while the error stays in the same order of magnitude. I think CORDIC is fascinating but not used in modern times.

    • @charlesgantz5865
      @charlesgantz5865 ปีที่แล้ว +1

      @@BoxingDayAC I think the same thing about CORDIC. It went out of favor when math co-processors became ubiquitous. With the fast multipliers, and cheap memory, CORDIC just wasn't needed anymore. I think though it is still used in cases where there is no math co-processor, such as in FPGA's, and some small devices.

  • @edgeeffect
    @edgeeffect ปีที่แล้ว +1

    That's excellent... I still use LUTs... but your explanation has just made my LUTs a whole lot smaller... to be honest I should have got all that symmetry stuff years ago. But that's why you're making videos about mathematics and I'm just writing bone head comments.

  • @ThePeterDislikeShow
    @ThePeterDislikeShow ปีที่แล้ว +1

    When I was a kid I used to think calculators had a very small perfect circle in them and when you hit a trig function it literally does a measurement maybe with lasers.

    • @simondev758
      @simondev758  ปีที่แล้ว

      Hah

    • @ThePeterDislikeShow
      @ThePeterDislikeShow ปีที่แล้ว

      @@simondev758 Would it work at least? You'd think there's some sort of physical device that could do trig.

    • @jesusandrade1378
      @jesusandrade1378 8 หลายเดือนก่อน

      ​@@ThePeterDislikeShowthere are mechanical computers made entirely of Mechanisms as seen in the courses of Kinematics (links, joints, cams, gears, etc.) or "Kinematics of Mechanisms" and "Dynamics of Machinery". The book by (Bela L.) Sandor of 1967 or 1968 shows a photo with the internal components already assembled. This mechanical computer can even do integration (and I think differentiation, too)

  • @theastuteangler
    @theastuteangler ปีที่แล้ว +1

    Wow, very well done!

  • @etma_
    @etma_ ปีที่แล้ว +1

    hi, can you make a video on spirals and how they generated? thank you

  • @byronwatkins2565
    @byronwatkins2565 ปีที่แล้ว +1

    There is a fast algorithm that starts at pi/4 (45 deg) and computes sin() and cos() simultaneously; I don't know what it is called.

  • @legate7158
    @legate7158 ปีที่แล้ว +1

    More educational than high-school

  • @happyfarang
    @happyfarang 8 หลายเดือนก่อน +1

    excellent video.

  • @Finkelfunk
    @Finkelfunk ปีที่แล้ว +1

    That is somewhat true on the software side, but this is far from what modern processors do. Modern processors either have the trig functions built in like the exp and ln functions or use CORDIC to approximate which is what libraries like math.h use when calling __kernel_sin.

    • @simondev758
      @simondev758  ปีที่แล้ว

      I'd be interested in a reference, because one of the other commenters is literally one of the people cited in the intel paper, implementing this on their hardware.

  • @alexandrshatilov8227
    @alexandrshatilov8227 ปีที่แล้ว

    Am I recognised right that at 6:47 there is a typo in switch parameter? It should be "quadrant" instead of "k"?