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

当尝试强制转换 NumericRealNumIntRat 失败时发生(例如,由于数字的虚部不为零)。

例如

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

方法§

方法源§

method source(--> Numeric:D)

返回未能强制转换为 Real 的数字。

方法目标§

method target()

返回尝试强制转换到的类型。

方法原因§

method reason(--> Str:D)

返回转换失败的原因。

类型图§

X::Numeric::Real 的类型关系
raku-type-graph 中文 Real 中文 Real Numeric 中文 Numeric Real->Numeric 中文 Mu 中文 Mu Any 中文 Any Any->Mu 中文 Cool 中文 Cool Cool->Any 中文 Num 中文 Num Num->Real 中文 Num->Cool 中文 Instant 中文 Instant Instant->Real 中文 Instant->Cool 中文 Duration 中文 Duration Duration->Real 中文 Duration->Cool 中文 Rational 中文 Rational Rational->Real 中文 Int 中文 Int Int->Real 中文 Int->Cool 中文 Stringy 中文 Stringy Str 中文 Str Str->Cool 中文 Str->Stringy 中文 Allomorph 中文 Allomorph Allomorph->Str 中文 NumStr 中文 NumStr NumStr->Num 中文 NumStr->Allomorph 中文 atomicint 中文 atomicint atomicint->Int 中文 Bool 中文 Bool Bool->Int 中文 IntStr 中文 IntStr IntStr->Int 中文 IntStr->Allomorph 中文 Order 中文 Order Order->Int 中文 Signal 中文 Signal Signal->Int 中文 int 中文 int int->Int 中文 Endian 中文 Endian Endian->Int 中文 PromiseStatus 中文 PromiseStatus PromiseStatus->Int 中文 FatRat 中文 FatRat FatRat->Cool 中文 FatRat->Rational 中文 Rat 中文 Rat Rat->Cool 中文 Rat->Rational 中文

展开上方的图表