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

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.

主站蜘蛛池模板: 略阳县| 铜山县| 瑞安市| 清徐县| 邯郸市| 台江县| 修水县| 湖口县| 靖州| 云和县| 元氏县| 马关县| 齐齐哈尔市| 定远县| 梨树县| 龙岩市| 辰溪县| 吴川市| 攀枝花市| 阿拉善盟| 绥宁县| 武隆县| 炉霍县| 镇康县| 民丰县| 绥棱县| 法库县| 家居| 香河县| 平泉县| 贡觉县| 思茅市| 江源县| 古浪县| 铜梁县| 泾川县| 敖汉旗| 营山县| 托里县| 阜宁县| 康马县|