Live data from Hacker News

Even faster asin() was staring right at me

16bpp.net

61–68 of 68 posts

Re: Even faster asin() was staring right at me

#61

Earlier quoted context omitted.

It isnt good idea to store such values in code. I think it is something that computed when a programming environment is booting up. E.g. when you run "python", or install "python". I try to understand how Math.sin works. There is Math.cos. It is sin +90 degrees. So not all of them is something that completes a big puzzle.

There's no nice way of saying this, and I mean no malice here, but I think you're exceptionally confused or ignorant, and I don't think it would be rewarding for either of us to continue this conversation.

It's ok if you don't reply If you don't have something to add to my saying. I think it is generated in like

for x in range(0, 90): for y in range(0, 90): if xx + yy So for the each x, the one that has the greatest y will be the sin.

Something like floatrange(0,1,0.001) may work too.

Re: Even faster asin() was staring right at me

#62

Earlier quoted context omitted.

There's no nice way of saying this, and I mean no malice here, but I think you're exceptionally confused or ignorant, and I don't think it would be rewarding for either of us to continue this conversation.

It's ok if you don't reply If you don't have something to add to my saying. I think it is generated in like for x in range(0, 90): for y in range(0, 90): if x x + y y So for the each x, the one that has the greatest y will be the sin. Something like floatrange(0,1,0.001) may work too.

> I think it is generated in like

You can think whatever you want, that's no substitute for being correct.

Re: Even faster asin() was staring right at me

#63

Earlier quoted context omitted.

The compiler can substitute the value how it sees fit. It's like #define, but type-safe and scoped. Maybe it's folded into expressions, propagated through constant expressions, or used it in contexts that require compile-time constants (template parameters, array sizes, static_assert, other constexpr expressions). I mean, not in this case of pi/2, where it's more about announcing semantics, but in general those are t…

I'd like something like this in C or C++ quite honestly. Something like a struct that I can say "this struct is global to the whole program and everyone can see it, but once this function exits those values are locked in". Maybe something like that one function is allowed to unlock and update it, but nowhere else. Think in terms of storing a bunch of precomputed coefficients that are based on the samplerate of a syst…

Same, this is something I would use often. Sort of like #pragma once, but for initialization.

Re: Even faster asin() was staring right at me

#64

Earlier quoted context omitted.

It's ok if you don't reply If you don't have something to add to my saying. I think it is generated in like for x in range(0, 90): for y in range(0, 90): if x x + y y So for the each x, the one that has the greatest y will be the sin. Something like floatrange(0,1,0.001) may work too.

> I think it is generated in like You can think whatever you want, that's no substitute for being correct.

This is not about being correct. Posted article looks like a clickbait. I am digging what really is about. I would like to dig more Imho. I am looking for work here.

Re: Even faster asin() was staring right at me

#65
post #57

Earlier quoted context omitted.

How did you find out that his optimization was done for a different equation, just by trial?

Just looking at the formula in the code (and the book it came from), we see that the approximation is of form arcsin(x) = π/2 - P(x)*sqrt(1-x). It is called a minimax solution in both, and the simplest form of minimax optimization is for polynomials. So we look at P(x) = (π/2 - arcsin(x))/sqrt(1-x): plotting out its error function with the original coefficients, it has the clear equioscillations that you'd expect fro…

Thank you for elaborating!

Re: Even faster asin() was staring right at me

#67

Earlier quoted context omitted.

What do you mean brute force? We can compute these things using iteration or polynomial approximations (sufficient for 64 bit).

There is a loop of is it close enough or not something like that. It is a brute force. Atan2 purely looks like that to me.

It’s not just guessing, there is theory to prove convergence and rates of converge.

Many algorithms require iteration.

Re: Even faster asin() was staring right at me

#68

Earlier quoted context omitted.

There is a loop of is it close enough or not something like that. It is a brute force. Atan2 purely looks like that to me.

It’s not just guessing, there is theory to prove convergence and rates of converge. Many algorithms require iteration.

I don't think these functions are programmed as it looks like they are in their Math form. Atan2 is something like a line-to rotating, if the given point is close to any pixel of line-to, returns how many times the line to is rotated. It is almost a motion but an algorithm. This is why I'm telling it is a brute force.
Post reply on HN