class X::Numeric::Real is Exception { }

Occurs when an attempt to coerce a Numeric to a Real, Num, Int or Rat fails (due to a number with a nonzero imaginary part, for instance).

For example

say (1+2i).Int;
CATCH { default { put .^name, ': ', .Str } };
# OUTPUT: «X::Numeric::Real: Can not convert 1+2i to Int: imaginary part not zero␤»

Methods§

method source§

method source(--> Numeric:D)

Returns the number that failed to coerce to Real.

method target§

method target()

Returns the type to which the coercion was attempted.

method reason§

method reason(--> Str:D)

Returns the reason that the conversion failed.

Typegraph§

Type relations for X::Numeric::Real
raku-type-graph Real Real Numeric Numeric Real->Numeric Rational Rational Rational->Real Mu Mu Any Any Any->Mu Cool Cool Cool->Any Int Int Int->Real Int->Cool Instant Instant Instant->Real Instant->Cool Duration Duration Duration->Real Duration->Cool Num Num Num->Real Num->Cool Signal Signal Signal->Int Stringy Stringy Str Str Str->Cool Str->Stringy Allomorph Allomorph Allomorph->Str IntStr IntStr IntStr->Int IntStr->Allomorph PromiseStatus PromiseStatus PromiseStatus->Int int int int->Int Bool Bool Bool->Int atomicint atomicint atomicint->Int Order Order Order->Int Endian Endian Endian->Int NumStr NumStr NumStr->Num NumStr->Allomorph FatRat FatRat FatRat->Rational FatRat->Cool Rat Rat Rat->Rational Rat->Cool

Expand chart above