mirror of
https://github.com/QB64Official/qb64.git
synced 2024-08-30 21:10:16 +00:00
51 lines
2.6 KiB
Text
51 lines
2.6 KiB
Text
|
{{DISPLAYTITLE:_ASIN}}
|
||
|
The '''_ASIN''' function returns the angle measured in radians based on an input [[SIN]]e value ranging from -1 to 1.
|
||
|
|
||
|
|
||
|
{{PageSyntax}}
|
||
|
::::: radian_angle! = _ASIN(''sine_value!'')
|
||
|
|
||
|
|
||
|
* The ''sine_value!'' must be measured >= -1 and <= 1, or else it will generate a return value of -1.#IND, which is basically QB64's way of telling us that the number doesn't exist.
|
||
|
* ARCSINE is the inverse function of [[SIN]]e, and turns a [[SIN]]e value back into an angle.
|
||
|
* Note: Due to rounding with floating point math, the _ASIN may not always give a perfect match for the SIN 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]].
|
||
|
|
||
|
* ''(Only available in QB64-GL, from Dirty Builds after 06/20/2014. Previous versions of QB64 don't support this command.)''
|
||
|
|
||
|
|
||
|
''Example:'' Converting a radian angle to its SINe and using that value to find the angle in degrees again using _ASIN:
|
||
|
{{CodeStart}} '' ''
|
||
|
{{Cl|DEFDBL}} A-Z
|
||
|
|
||
|
{{Cl|INPUT}} "Give me an Angle (in Degrees) => "; Angle
|
||
|
{{Cl|PRINT}}
|
||
|
C = {{Cl|SIN}}({{Cl|_D2R}}(Angle)) '_D2R is the command to convert Degrees to Radians, which is what SIN expects
|
||
|
{{Cl|PRINT}} "The SINE of the Angle is: "; C
|
||
|
A = {{Cl|_ASIN}}(C)
|
||
|
{{Cl|PRINT}} "The ASIN 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 SINE of the Angle is: .8660254037844386
|
||
|
The ACOS of .8660254037844386 is: 1.047197551196598
|
||
|
Notice, A is the Angle in Radians. If we convert it to degrees, we discover the value is 60
|
||
|
{{OutputEnd}}
|
||
|
|
||
|
|
||
|
''See also:''
|
||
|
* [[_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)}}
|
||
|
* [[_ACOS]] {{text|(arc cosine)}}, [[_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}}
|