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

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.

主站蜘蛛池模板: 含山县| 黄山市| 德清县| 湖南省| 内乡县| 萝北县| 博客| 黄龙县| 江口县| 舞阳县| 海丰县| 磐石市| 华宁县| 三门县| 西吉县| 罗田县| 客服| 双流县| 镇赉县| 茌平县| 周至县| 大安市| 子长县| 若羌县| 大埔区| 扬州市| 益阳市| 邮箱| 杭锦旗| 肥西县| 安达市| 南安市| 武陟县| 芒康县| 凉山| 瓦房店市| 衢州市| 突泉县| 凉城县| 获嘉县| 张北县|