Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Rightclick on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: Pavel <pavel@pa...>  20140619 20:55:22

Hi André, I have some comments to the sinf implementation. First of all, calculating the factorials in separate function is quite inefficient, since you repeat multiplication of what has already been multiplied. Slightly better would be to declare local variable and calculate the factorial in the for loop: float fact = 1; float y = 1; float res = y; for(int i = 1; i < 6; i++) { y *= x; fact *= i; res += y/fact; } this is rather an example for exp function, sine would require a modification. And since you only calculate 6 values, it would be even better to precalculate them and hardcode them in a table. However, calculating goniometric functions from Taylor expansion is quite inefficient and slow in general. In your algorithm, you use 6 values and power of 11, which itself introduces some error. The accuracy of your implementation is 4 decimal digits at pi/2, where I believe the deviation is the highest. I suggest the following formula for calculating sine at (0, pi/2) interval: sin(x) = (0.99996736*x  0.09779183*x^2  0.12839086*x^3 + 0.01826627*x^4) / (1  0.09809942*x + 0.03936879*x^2) This is accurate at 6 decimal digits in the whole interval, moreover it matches the values at 0, pi/12, pi/6, pi/4, pi/3, 5*pi/12 and pi/2 exactly. The highest deviation magnitude is about 7.8e7. I have derived the coefficients using R. cosine can be then calculated as sin(pi/2  x) at the (0, pi/2) interval. So I hope it might help you. Pavel On Mon, 20140616 at 23:04 +0200, André Hentschel wrote: > BEGIN PGP SIGNED MESSAGE > Hash: SHA1 > > Am 16.06.2014 21:51, schrieb Kai Tietz: > > 20140616 21:16 GMT+02:00 André Hentschel <nerv@...>: > >> BEGIN PGP SIGNED MESSAGE > >> Hash: SHA1 > >> > >> Please review this initial implementation for the remaining math functions > >> I'm unsure about the folder name and the license for taylor_private.h, it mostly contains > >> defines/typedefs/consts from FreeBSD... > > > > Well, license is BSD. That's actuallly ok. > > ok, true > > > What is about the accuracy of the sinf/cosf implementation? > > It might be of interest to replace for x64 the current x87 > > implementation by softfloat, too. > > As discussed on IRC i'll continue the plan of bringing the algorithms and build system changes in and later we see what we can do for amd64 > > BEGIN PGP SIGNATURE > Version: GnuPG v1 > Comment: Using GnuPG with Thunderbird  http://www.enigmail.net/ > > iQGcBAEBAgAGBQJTn1vLAAoJEGm5GZTakYssUFML/1WN9ff0SZLmMy5j8pgPIO3h > lHIwEPL8Bau+aHr/TNlah7ihnKToXgqGHlOkP6y757ZAdr1t5AZoOKmGILVFJ8xz > 0xBSWp3LNCHtivBvz4x9AFLiTQCvXuHkpFgl6Kcw/sec3n6++ZN4OxOg8InoKgXs > JTz5ylLcwLiwTftWa+2Twx90q+TVw61AbOCb7KK7EiA2cDZCBNf7b+6tBIH5BcdR > xKjJFsuW+Wqdp4+IvHsI2zKm3Dx2IfJPn1q/Ht1RCJE/Ly5SMYzBKAtzrgJt63tj > RkOltTUADuM29uKoR2IvAFRNcRy7fbkMLtcqd0u8yJXXMfWeyrXVQqKm0PjNQVYc > 4JFqhfrW3ra7tCfPZmC9d5dN8EGj45nLSJGw7kTpuDKcAj95Nr2NmlI5/2IYe03E > uvOGynAGh4dNVJH6JELYFJ1B7KJSKHaBylv7Dvajg18vrDlQcoi8lsWSMXFloPRB > xYTl//LvfKHGpxBmv8AHxR/G/ZCS8FNVHb6yxJXpZA== > =vomx > END PGP SIGNATURE > >  > HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions > Find What Matters Most in Your Big Data with HPCC Systems > Open Source. Fast. Scalable. Simple. Ideal for Dirty Data. > Leverages Graph Analysis for Fast Processing & Easy Data Exploration > http://p.sf.net/sfu/hpccsystems > _______________________________________________ > Mingww64public mailing list > Mingww64public@... > https://lists.sourceforge.net/lists/listinfo/mingww64public 