From: Seebs Date: 2009-12-28T15:31:00+09:00 Subject: Re: Trig value errors On 2009-12-28, jzakiya wrote: > No, YOU still don't seem to know the difference between > precision an accuracy. I certainly do. > If you can READ I said my method is no more precise, i.e > it CANNOT resolve angular differences past the inherent > precision of the native trig functions. Right. > But what you, and your cohorts, don't want to deal with, is my method > IS MORE ACCURATE for sin|cos on the x|y axis angles, whereas the > native functions are INACCURATE. For any point you special case, there is a range of possible inputs which yield something close enough that you automatically round it. For all but one of those inputs, your method is LESS ACCURATE. There is no reason to treat those particular points as specially deserving of extra accuracy, to such an extent that you should make other nearby input values less accurate. > YOU, can't SHOW that my method is inaccurate for any > angle value. Can YOU? We already went through this. Your method is inaccurate for any value for which the resulting value is within the range you picked of values which are "really close to zero". In the long run, there are many, many, more such values than there are values for which your method is "more accurate". Again, the problem here is simply that you don't understand what rounding is, and when it should be done. If you want round numbers, round them. Don't add a large computational expense (keep in mind that on some machines, sin(x) may be in hardware, so you're replacing a single instruction with a large hunk of interpreted code) to every single trig function, introducing errors for a large number of them, just to avoid having to round values if you want them rounded. Let's see. You originally set your boundary to 1e-11, then improved it to 1e-14, yes? Okay, let's see. Here's a range of values (in doubles, since you were complaining about an e-16) near 180 which produce values ranging from 1e-14 to -1e-14. You will notice that, for all of these values except the one right in the middle, yours produces an inaccuracy GREATER in magnitude than the inaccuracy reported for 180.0. Which is to say... It's wrong more often than it's right, and by a larger margin. sin(179.99999999999940314410) = 1.0336512461933677897718553e-14 sin(179.99999999999943156581) = 9.8924232520836152815491005e-15 sin(179.99999999999945998752) = 9.4483340422335526653796478e-15 sin(179.99999999999948840923) = 9.0042448323834900492101951e-15 sin(179.99999999999951683094) = 8.5601556225334274330407425e-15 sin(179.99999999999954525265) = 8.1160664126833648168712898e-15 sin(179.99999999999957367436) = 7.6719772028333022007018371e-15 sin(179.99999999999960209607) = 7.2278879929832395845323845e-15 sin(179.99999999999963051778) = 6.7837987831331769683629318e-15 sin(179.99999999999965893949) = 5.8956203634330517360240265e-15 sin(179.99999999999968736120) = 5.4515311535829891198545738e-15 sin(179.99999999999971578291) = 5.0074419437329265036851211e-15 sin(179.99999999999974420462) = 4.5633527338828638875156685e-15 sin(179.99999999999977262632) = 4.1192635240328012713462158e-15 sin(179.99999999999980104803) = 3.6751743141827386551767631e-15 sin(179.99999999999982946974) = 3.2310851043326760390073105e-15 sin(179.99999999999985789145) = 2.7869958944826134228378578e-15 sin(179.99999999999988631316) = 1.8988174747824881904989525e-15 sin(179.99999999999991473487) = 1.4547282649324255743294998e-15 sin(179.99999999999994315658) = 1.0106390550823629581600471e-15 sin(179.99999999999997157829) = 5.6654984523230034199059446e-16 sin(180.00000000000000000000) = 1.2246063538223772582114179e-16 sin(180.00000000000002842171) = -3.2162857446782489034831087e-16 sin(180.00000000000005684342) = -7.6571778431788750651776354e-16 sin(180.00000000000008526513) = -1.2098069941679501226872162e-15 sin(180.00000000000011368684) = -1.6538962040180127388566689e-15 sin(180.00000000000014210855) = -2.5420746237181379711955742e-15 sin(180.00000000000017053026) = -2.9861638335682005873650269e-15 sin(180.00000000000019895197) = -3.4302530434182632035344795e-15 sin(180.00000000000022737368) = -3.8743422532683258197039322e-15 sin(180.00000000000025579538) = -4.3184314631183884358733849e-15 sin(180.00000000000028421709) = -4.7625206729684510520428375e-15 sin(180.00000000000031263880) = -5.2066098828185136682122902e-15 sin(180.00000000000034106051) = -5.6506990926685762843817429e-15 sin(180.00000000000036948222) = -6.5388775123687015167206482e-15 sin(180.00000000000039790393) = -6.9829667222187641328901009e-15 sin(180.00000000000042632564) = -7.4270559320688267490595535e-15 sin(180.00000000000045474735) = -7.8711451419188893652290062e-15 sin(180.00000000000048316906) = -8.3152343517689519813984589e-15 sin(180.00000000000051159077) = -8.7593235616190145975679116e-15 sin(180.00000000000054001248) = -9.2034127714690772137373642e-15 sin(180.00000000000056843419) = -9.6475019813191398299068169e-15 sin(180.00000000000059685590) = -1.0091591191169202446076270e-14 -s -- Copyright 2009, all wrongs reversed. Peter Seebach / usenet-nospam@seebs.net http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!