Inverse Cosine

jboavida
 
Avatar
 
Subject:

Inverse Cosine

 · 
Posted: 12.07.2010 - 16:06  ·  #1
Hi All,

Is there a function to calculate the inverse cosine in AVRCO? I found it but only in Fix64 Math.
I need to implement using Float.

edit

I'm looking for the ArcCosine function (Acos)

end edit

Thanks

Joaquim
ThomasW69
 
Avatar
 
Subject:

Re: Inverse Cosine

 · 
Posted: 13.07.2010 - 08:29  ·  #2
Code
function ArcCos(x : float) : float;
begin
  Return(ATan2(Sqrt(1 - X * X), X));
end;


with
Code


const  HalfPI     : float = PI/2.0;


function ATan2( y : float; x : float ) : float;
var arctan2: float;
begin
  if X = 0.0 then
    if y = 0.0 then
      // (* Error! Send Error Message *)
    elsif y > 0.0 then
      arctan2 := halfPi;
    else
      arctan2 := - halfpi;
    endif;
  else
    if X > 0.0 then
      arctan2:= ArcTan( y / x );
    elsif X < 0.0 then
      if y >= 0.0 then
        arctan2:= ArcTan( y / X ) + pi;
      else
        arctan2:= ArcTan( y / X ) - pi;
      endif;
    endif;
  endif;
  Return(arctan2);
end;
jboavida
 
Avatar
 
Subject:

Re: Inverse Cosine

 · 
Posted: 14.07.2010 - 18:40  ·  #3
Thank you ThomasW69
Best
Joaquim
Selected quotes for multi-quoting:   0

Registered users in this topic

Currently no registered users in this section

The statistic shows who was online during the last 5 minutes. Updated every 90 seconds.
MySQL Queries: 15 · Cache Hits: 13   64   77 · Page-Gen-Time: 0.031547s · Memory Usage: 2 MB · GZIP: on · Viewport: SMXL-HiDPI