On 8/29/22 19:07, Jeff Law via Gcc-patches wrote:

One of the more interesting ones is to try to limit the range of the input to the trigonometric functions - that way you could use ones without any argument reduction phase ...

The difficult part is that most of the trig stuff is in libraries, so we don't have visibility into the full range.

What we do sometimes have is knowledge that the special values are already handled which allows us to do things like automatically transform a division into estimation + NR correction steps (atan2).

I guess we could do specialization based on the input range.  So rather than calling "sin" we could call a special one that didn't have the reduction step when we know the input value is in a sensible range.

Exactly. It's probably not that hard to have sin/cos/tan with a special entry point that foregoes the whole argument reduction step.

In every weather forecast, you have to compute the local solar height (to get the effects of solar radiation correct) every time step, in every grid point.

You *know* that angle is between 0 and 90 degrees, as are all the angles that go into that computation (latitude, longitude (and time [hour of the day, day of the year]).

--
Toon Moene - e-mail: t...@moene.org - phone: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands

Reply via email to