Skip to content

Modern Math CIsReal

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

Home › Math Library › Math Library › CIsReal

CIsReal

Returns true if the imaginary part of a complex number is zero.

Syntax

CIsReal( byref z as Complex ) as boolean

Notes

  • True for a negative zero imaginary part. -0.0 = 0.0 as numbers, so CSet( 3, -0.0 ) is on the real axis — but which zero it carries decides which side of a branch cut it is on. IsNegative from math.tiko is what tells them apart.
  • A merely tiny imaginary part is not zero: 1e-320 is subnormal, not absent.

Examples

#import "std/numeric"
using numeric

print CIsReal( CSet( 3, 0 ) )       '' true
print CIsReal( CSet( 3, -0.0 ) )    '' true   -- the other zero is still zero
print CIsReal( CSet( 3, 1e-320 ) )  '' false   -- subnormal, not absent

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

Clone this wiki locally