Skip to content

Modern Math CReciprocal

Paul Squires edited this page Oct 19, 2026 · 5 revisions

Home › Math Library › Math Library › CReciprocal

CReciprocal

Returns one divided by a complex number; zero gives zero.

Syntax

CReciprocal( byref z as Complex ) as Complex

Notes

  • Zero gives zero, not an infinity. That is .NET's answer and it is pinned by a test; it is a choice, not a law.
  • Uses Smith's formula, so it does not overflow for operands near the type maximum.
  • z * CReciprocal( z ) is COne( ) to within rounding.
  • The Asec/Acsc/Acot family and the six Sec/Csc/Cot functions are all this composed with something else.
  • AfxNova spelled this CReciprocal and CInverse.

Examples

#import "std/numeric"
using numeric

dim as Complex z = CSet( 3, 4 )

print CToString( CReciprocal( z ) )         '' 0.12-0.16i
print CToString( z * CReciprocal( z ) )     '' 1+0i
print CToString( CReciprocal( CZero( ) ) )  '' 0+0i   -- zero, .NET's answer

Library: Math Library
Category: Math Library
Documented under: Members

Clone this wiki locally