Repository navigation
Modern Math CAcos
Paul Squires edited this page Oct 19, 2026
·
5 revisions
Home › Math Library › Math Library › CAcos
Returns the inverse cosine of a complex number, or of any real number.
CAcos( byref z as Complex ) as Complex
CAcos( byval x as float64 ) as Complex-
The Hull–Fairgrieve–Tang method, transcribed from .NET's
Asin_Internal. The textbook-i·Log( iz + CSqrt( 1 - z² ) )cancels catastrophically near the branch points at ±1, which is exactly where an inverse sine is most often evaluated. This does not. - Same NaN at exactly ±1 as
CAsin, and the same fix — that segment is answered directly. - Same cuts as
CAsin, and the same sign-bit correction against .NET. - The
float64overload is AfxNova'sCArcCosReal. - The imaginary part is the negation of
CAsin's:CAcos( 1 + 0i )is0 - 0i.
#import "std/numeric"
using numeric
print CToString( CAcos( CSet( 0.5, 0.25 ) ) ) '' 1.0691874735193958-0.2813960562452928i
print CToString( CAcos( CSet( 1, 0 ) ) ) '' 0-0i
print CToString( CAcos( 2.0 ) ) '' 0-1.3169578969248166i
print CToString( CAcos( CSet( -2, 0.0 ) ) ) '' 3.141592653589793-1.3169578969248166iLibrary: Math Library
Category: Math Library
Documented under: Members
tiko-lang · Home · Feature Index · Keyword Index · License
FreeBASIC manual pages reproduced under the GNU FDL 1.3.
- Generics
- Interfaces
- For Each
- Iterators
- Tuples
- Array Results
- Defer
- Lambdas
- Block Strings
- Partial Types
- String Slices
- Embed
- Typed Variadics
- C Header Import
- Foreign Library Linking
- UString
- Fixed-Width Types
- Nullptr
- String Library
- Format
- Array
- Map
- Set
- LinkedList
- OrderedMap
- OrderedSet
- Sorting
- Optional
- Result
- Smart Pointers
- Date and Time (Chrono)
- Filesystem
- File Streams
- Config (INI and TOML)
- Codec
- Hash
- UUID
- OS
- Process
- Net
- HTTP and TLS
- Math Library
- Finance
- Logging
- Terminal TUI Library
- PsControls
- tkControls
- sys/win
- Goroutines and Channels
- LLVM Backend
- tiko build
- TIKO_COMPILER
- Variable Declarations
- Standard Data Types
- User Defined Types
- Procedures
- Operators
- Control Flow Statements
- Converting Data Types
- Array Functions
- String Functions
- Mathematical Functions
- Bit Manipulation
- Date and Time Functions
- File I/O Functions
- Console Functions
- User Input (Runtime Library)
- User Input Functions (Graphics Library)
- Screen Functions
- 2D Drawing Functions
- Graphics Library Reference
- Graphics Keyword List
- Memory Functions
- Threading Support Functions
- Error Handling Functions
- Operating System Functions
- Preprocessor
- Intrinsic Defines
- Miscellaneous Keywords
- Modularizing