- Perl 6 Deep Dive
- Andrew Shitov
- 163字
- 2021-07-03 00:05:52
Numeric data type
The Num type is used to store floating-point values. It corresponds to the double precision in C.
Notice that, in Perl 6, the Num value is only created when the numeric literal is spelled in a scientific notation. That is, the E part of the value must be present.
Thus, in the following examples, the numbers with only a decimal point will be of the Rat type:
say 3.14; # Rat
say 123.456; # Rat
say 0.9; # Rat
The following numbers represent the same values, but are of the Num type, as they use the exponential part in their definition:
say 3.14E0; # Num
say 1.23456E2; # Num
say 9E-1; # Num
Remember that the Num values use the packed IEEE binary format, so they are limited in precision, while Rat numbers keep their numerator and denominator as two integer numbers.
Among the Num values, there is one outstanding value of NaN, which stands for Not a Number.
- Learn ECMAScript(Second Edition)
- Learning Cython Programming
- ASP.NET MVC4框架揭秘
- ASP.NET Core 5.0開發入門與實戰
- 動手玩轉Scratch3.0編程:人工智能科創教育指南
- Visual C++串口通信技術詳解(第2版)
- The HTML and CSS Workshop
- 微信小程序入門指南
- Learning Raspbian
- Python High Performance Programming
- 詳解MATLAB圖形繪制技術
- Illustrator CS6設計與應用任務教程
- QGIS 2 Cookbook
- uni-app跨平臺開發與應用從入門到實踐
- 小程序從0到1:微信全棧工程師一本通