官术网_书友最值得收藏!

Num versus Numeric versus Real

As you saw in the diagram of the type hierarchy, some of the nodes are placed in ovals instead of rectangle boxes. Those are roles. Roles provide some interfaces to the classes that are inherited from them. We will talk about roles in more detail in Chapter 8, Object-Oriented Programming.

Some of the methods that the Numeric role provides us with are: Real, Int, Rat, Num, and Bool to convert the values to other data types; log, log10, exp, roots, abs, and sqrt for the corresponding mathematical calculations; and the pair prec and succ.

The Real role class gives us, among the rest, the following methods: rand, sign, round, floor, ceiling, and truncate.

If you want to dig deep and see all the connections between the classes, refer to the documentation pages listed at https://docs.perl6.org/type.html.

主站蜘蛛池模板: 苏州市| 台东市| 武川县| 报价| 石首市| 筠连县| 大埔区| 新巴尔虎左旗| 如皋市| 全南县| 仁怀市| 普格县| 桓仁| 平谷区| 饶阳县| 沭阳县| 吉水县| 牡丹江市| 嫩江县| 吕梁市| 铁岭市| 枣强县| 迁西县| 若羌县| 永顺县| 固镇县| 叶城县| 洛阳市| 永嘉县| 读书| 原阳县| 湟源县| 高青县| 错那县| 兴宁市| 博乐市| 蒙城县| 丹江口市| 和静县| 平泉县| 崇左市|