🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: can.schoolnet.math.sr
Article #737

Re: Can I get tan^-1 from tan

#737
From: 0
Date: Sat, 06 Jan 1996 00:00
37 lines
2060 bytes
ryangall@gpu.srv.ualberta.ca (Bobby Sixkiller) wrote:

>I am working on a computer program in c, and I need to find the angle of a 
>given line. I have access to a tan() function which takes an angle, and 
>returns the tan of that angle. The problem I'm facing is that I have 
>the tan of the angle already(opposite and adjacent values) but dont know 
>what the angle is.. thats what I want to find. I know that on a calculator 
>I could just go tan ^-1 opposite/adjacent to get the angle, but I dont 
>have acces to an inverse of tan function. Can I get the inverse of tan by 
>using only the tan() function and the opposite and adjacent 
>values.....please mail me any ideas!

Well, you might just brute force each one, depending on how time
critical the thing is. Something like:

float arctan(float y)
{
  float x;
  x=0;
  while (tan(x)<y) do x=x+0.01;
  return x
}

That'll do for up to pi, or 90 degrees, with .01 accuracy, but it will
be slow.  You could make it a lot faster, (10x actually) by making the
increment only .1.  If you have an arcsin function, you could use it
to calculate arctan I think...

 - Executioner/[Independent]
------====### legal notice ###====--------------------------------------------
Microsoft(tm) Network is prohibited from redistributing this work in any form,
either in whole or in part. License to distribute this posting is available to
Microsoft(tm) for (US)$100.00. Posting without prior permission constitutes an
agreement to these terms. Site license is available for (US)$10,000,000,000.00

PGP Signature: 67 35 1F 85 34 3D ED CC FD 87 01 22 A5 47 31 EA
Key available on request. 
Technical Details
Message-ID: <4ckk85$nm6@cliff.island.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <4c36ou$1qks@pulp.ucs.ualberta.ca>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f7972,4ae49718167a2d52
X-Google-Attributes: gidf7972,public
From: 0@0.0
Subject: Re: Can I get tan^-1 from tan
Date: 1996/01/06
Message-ID: <4ckk85$nm6@cliff.island.net>
X-Deja-AN: 134183627
references: <4c36ou$1qks@pulp.ucs.ualberta.ca>
organization: Island Internet Inc. - (604) 753-2383
newsgroups: can.schoolnet.math.sr