- 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.
- UI圖標(biāo)創(chuàng)意設(shè)計(jì)
- 控糖控脂健康餐
- .NET 4.0面向?qū)ο缶幊搪劊夯A(chǔ)篇
- JavaFX Essentials
- 三維圖形化C++趣味編程
- Object-Oriented JavaScript(Second Edition)
- Instant QlikView 11 Application Development
- C# Multithreaded and Parallel Programming
- C++ Application Development with Code:Blocks
- Mastering Elixir
- Java RESTful Web Service實(shí)戰(zhàn)
- Web前端測(cè)試與集成:Jasmine/Selenium/Protractor/Jenkins的最佳實(shí)踐
- 絕密原型檔案:看看專業(yè)產(chǎn)品經(jīng)理的原型是什么樣
- 開源網(wǎng)絡(luò)地圖可視化:基于Leaflet的在線地圖開發(fā)
- Visual Basic程序設(shè)計(jì)