mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-09-07 09:30:15 +00:00
89 lines
3.3 KiB
Text
89 lines
3.3 KiB
Text
|
{{QBDLDATE:05-20-2022}}
|
||
|
{{QBDLTIME:23:06:18}}
|
||
|
{{DISPLAYTITLE:_ACOS}}
|
||
|
The [[_ACOS]] function returns the angle measured in radians based on an input [[COS]]ine value ranging from -1 to 1.
|
||
|
|
||
|
|
||
|
{{PageSyntax}}
|
||
|
: {{Parameter|radian_angle!}} = [[_ACOS]]({{Parameter|cosine_value!}})
|
||
|
|
||
|
{{PageDescription}}
|
||
|
* The ''cosine_value!'' must be measured >= -1 and <= 1, or an error will be generated. (PRINT _ACOS(1.2) would give the result of -1.#IND, which is basically QB64's way of telling us that the number doesn't exist, much like 1/0 would.)
|
||
|
* ARCCOSINE is the inverse function of [[COS]]ine, which lets us turn a [[COS]]ine value back into an angle.
|
||
|
* Note: Due to rounding with floating point math, the _ACOS may not always give a perfect match for the COS angle which generated this. You can reduce the number of rounding errors by increasing the precision of your calculations by using [[DOUBLE]] or [[_FLOAT]] precision variables instead of [[SINGLE]].
|
||
|
|
||
|
|
||
|
==Availability==
|
||
|
* '''Version 1.000 and up.'''
|
||
|
|
||
|
|
||
|
{{PageExamples}}
|
||
|
''Example:'' Converting a radian angle to its COSine and using that value to find the angle in degrees again using _ACOS:
|
||
|
{{CodeStart}}
|
||
|
{{Cl|DEFDBL}} A-Z
|
||
|
|
||
|
{{Cl|INPUT}} "Give me an Angle (in Degrees) => "; Angle
|
||
|
{{Cl|PRINT}}
|
||
|
C = {{Cl|COS}}({{Cl|_D2R}}(Angle)) '_D2R is the command to convert Degrees to Radians, which is what COS expects
|
||
|
{{Cl|PRINT}} "The COSINE of the Angle is: "; C
|
||
|
A = {{Cl|_ACOS}}(C)
|
||
|
{{Cl|PRINT}} "The ACOS of "; C; " is: "; A
|
||
|
{{Cl|PRINT}} "Notice, A is the Angle in Radians. If we convert it to degrees, the value is "; {{Cl|_R2D}}(A)
|
||
|
{{CodeEnd}}
|
||
|
{{small|Example by SMcNeill}}
|
||
|
{{OutputStart}}
|
||
|
Give me an Angle (in Degrees) => ? 60
|
||
|
|
||
|
The COSINE of the Angle is: .5000000000000001
|
||
|
The ACOS of .5000000000000001 is: 1.047197551196598
|
||
|
Notice, A is the Angle in Radians. If we convert it to degrees, we discover the value is 60
|
||
|
{{OutputEnd}}
|
||
|
|
||
|
|
||
|
{{PageSeeAlso}}
|
||
|
* [[_D2G]] {{text|(degree to gradient}}, [[_D2R]] {{text|(degree to radian)}}
|
||
|
* [[_G2D]] {{text|(gradient to degree)}}, [[_G2R]] {{text|(gradient to degree}}
|
||
|
* [[_R2D]] {{text|(radian to degree)}}, [[_R2G]] {{text|(radian to gradient}}
|
||
|
* [[COS]] {{text|(cosine)}}, [[SIN]] {{text|(sine)}}, [[TAN]] {{text|(tangent)}}
|
||
|
* [[_ASIN]] {{text|(arc sine)}}, [[ATN]] {{text|(arc tangent)}}
|
||
|
* [[_ACOSH]] {{text|(arc hyperbolic cosine)}}, [[_ASINH]] {{text|(arc hyperbolic sine)}}, [[_ATANH]] {{text|(arc hyperbolic tangent)}}
|
||
|
* [[_ATAN2]] {{text|(Compute arc tangent with two parameters)}}
|
||
|
* [[_HYPOT]] {{text|(hypotenuse)}}
|
||
|
*[[Mathematical Operations]]
|
||
|
*[[Mathematical_Operations#Derived_Mathematical_Functions|Derived Mathematical Functions]]
|
||
|
|
||
|
|
||
|
{{PageNavigation}}
|
||
|
|
||
|
Templates used on this page:
|
||
|
|
||
|
Template:Cl (view source)
|
||
|
Template:CodeEnd (view source)
|
||
|
Template:CodeStart (view source)
|
||
|
Template:OutputEnd (view source)
|
||
|
Template:OutputStart (view source)
|
||
|
Template:PageDescription (view source)
|
||
|
Template:PageExamples (view source)
|
||
|
Template:PageNavigation (view source)
|
||
|
Template:PageSeeAlso (view source)
|
||
|
Template:PageSyntax (view source)
|
||
|
Template:Parameter (view source)
|
||
|
Template:Small (view source)
|
||
|
Template:Text (view source)
|
||
|
Return to ACOS.
|
||
|
|
||
|
Navigation menu
|
||
|
Log inPageDiscussionReadView sourceView historySearch
|
||
|
Search QB64 Wiki
|
||
|
Main page
|
||
|
Recent changes
|
||
|
Random page
|
||
|
Help about MediaWiki
|
||
|
Tools
|
||
|
What links here
|
||
|
Related changes
|
||
|
Special pages
|
||
|
Page information
|
||
|
Privacy policyAbout QB64 WikiDisclaimersPowered by MediaWiki
|
||
|
|