Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   HELP: How do i make Arcsin in MPLAB (http://www.chiefdelphi.com/forums/showthread.php?t=54128)

Tottanka 14-02-2007 11:20

HELP: How do i make Arcsin in MPLAB
 
Hey
An important question for our team:
How do i make arcsin in MPlab, not using a 1 to 180 loop checking every angle and finding the closest one to the value i need?

thanks, the Black Knights

Shinigami2057 14-02-2007 11:57

Re: HELP: How do i make Arcsin in MPLAB
 
Should be in <math.h>.

Code:

#include <math.h>

double asin(double x);
float asinf(float x);


efoote868 14-02-2007 12:18

Re: HELP: How do i make Arcsin in MPLAB
 
you could make a lookup table... a large array usually can do the trick. It'll save you the processing power from not using a double, but it'll eat up memory pretty quickly.

Guy Davidson 14-02-2007 12:28

Re: HELP: How do i make Arcsin in MPLAB
 
I would try and google arcsin approximation and find one that only involves rational expressions, to limit the amount of floating point math.

Jared Russell 14-02-2007 17:48

Re: HELP: How do i make Arcsin in MPLAB
 
There was a whitepaper on Delphi a couple years ago about CORDIC trig implementations...you should look it up.

Cheezmeister 15-02-2007 15:22

Re: HELP: How do i make Arcsin in MPLAB
 
Quote:

Originally Posted by Shinigami2057 (Post 578063)
Should be in <math.h>.

Code:

#include <math.h>

double asin(double x);
float asinf(float x);


You don't know how long we were pulling our hair out last year because it couldn't parse "arcsin(x)" (not to mention me repeatedly telling others that "1/sin(x)" would NOT do it) ;D

aaeamdar 15-02-2007 15:33

Re: HELP: How do i make Arcsin in MPLAB
 
Quote:

Originally Posted by Cheezmeister (Post 578873)
You don't know how long we were pulling our hair out last year because it couldn't parse "arcsin(x)" (not to mention me repeatedly telling others that "1/sin(x)" would NOT do it) ;D

This is humerous, but likely the result of what I am informed is another case of poor american practice (or practise). arcsin is usually written sin^(-1), and this can cause confusions, since x^(-1) would in fact equal 1/x. However, in the case of sin^(-1) (and other inverse trig operations), it just means arcsin.

I could be wrong about the fact that it's american in origin, but I imagine that's the root of your problem.

Paul

fallen751 15-02-2007 15:39

Re: HELP: How do i make Arcsin in MPLAB
 
If your range of data is within a pretty reasonable small area like (0, pi/2) you could try doing a fifth or sixth degree taylor polynominal instead - it might help with the processing power. then again, if your not performing many other calculations the arctanx function should work fine. (remember it returns radians.)


All times are GMT -5. The time now is 04:54.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi