Thread history

From User talk:Rednaxela/FastTrig
Viewing a history listing
Jump to navigation Jump to search
Time User Activity Comment
22:42, 18 February 2012 MN (talk | contribs) Comment text edited  
22:42, 18 February 2012 MN (talk | contribs) Comment text edited  
02:10, 16 February 2012 MN (talk | contribs) Comment text edited  
01:27, 16 February 2012 MN (talk | contribs) New reply created (Reply to Fast Math.exp)
23:03, 17 September 2011 Voidious (talk | contribs) New reply created (Reply to Fast Math.exp)
22:56, 17 September 2011 Darkcanuck (talk | contribs) New reply created (Reply to Fast Math.exp)
21:00, 17 September 2011 Voidious (talk | contribs) New reply created (Reply to Fast Math.exp)
21:00, 17 September 2011 Voidious (talk | contribs) New reply created (Reply to Fast Math.exp)
20:55, 17 September 2011 Darkcanuck (talk | contribs) New reply created (Reply to Fast Math.exp)
20:40, 17 September 2011 Voidious (talk | contribs) New thread created  

Fast Math.exp

I started on a FastMath class and then caved and started playing with this one. Just thought I'd offer up a fast Math.exp I found from this blog (via StackOverflow):

public static double exp(double val) {
    final long tmp = (long) (1512775 * val + 1072632447);
    return Double.longBitsToDouble(tmp << 32);
}

Probably doesn't matter to most of you, but if you're doing DC with gaussians it might. I actually use a different kernel density in my main gun because 20,000 Math.exp's each time I aim would be pretty slow. (Not sure the above would solve that, but anyway...)

Voidious20:40, 17 September 2011

Didn't I post that just above?

Darkcanuck20:55, 17 September 2011
 

FYI - testing for values between -20 and 0, which would be the range if you're doing gaussians with bandwidth = 1/2 bot width and up to 40 bot widths.

Math.exp() time: 0.30864 seconds
FastMath.exp() time: 0.06371 seconds
FastMath.exp() worst error: 0.02899
FastMath.exp() avg error: 0.00073

Or for -3 to 0:

== exp Test ==
Math.exp() time: 0.38425 seconds
FastMath.exp() time: 0.07076 seconds
FastMath.exp() worst error: 0.02899
FastMath.exp() avg error: 0.00464
Voidious21:00, 17 September 2011
 

Oh, haha - sorry, I didn't see it in the file...

Voidious21:00, 17 September 2011
 

Yeah, I didn't update the main page, didn't want to overwrite others' functions. Try the atan/atan2 I posted, they're much more accurate I think.

Darkcanuck22:56, 17 September 2011
 

Yep - already tested them, using them, and running a long benchmark with a FastMath Diamond. =) I actually haven't noticed any huge speed increase in Diamond, so I'm hesitant to keep all this FastMath stuff. But it is faster and the error rate looks pretty low, so if I don't take any score hit I'll definitely keep it.

Voidious23:03, 17 September 2011
 

Just tried that fast exp with a dc/gaussian kernel/swarm targeting gun. 5,5% APS decrease in meleerumble, 12,4% APS decrease in teamrumble. :( Too imprecise for swarm targeting, and you notice the gun shaking a lot more. But in 1v1 there was no APS hit (0,1% APS increase).

Found out its because that function doesn´t work for values outside -700 and 700.

MN01:27, 16 February 2012