- Learning Rust
- Paul Johnson Vesa Kaihlavirta
- 91字
- 2021-07-02 23:07:15
Float
Much as with other languages, floating point arithmetic can be performed in Rust. As with an integer variable, a floating point variable is defined for a 32-bit float as follows:
let pi = 3.14f32;
For a 64-bit float, it will be defined as this:
let pi = 3.14f64;
The variables are literal values. Another way to declare the size would be via types:
let pi: f32 = 3.14;
If a type is omitted (for example, let x = 3.14), the variable will be declared as a 64-bit floating point variable.
推薦閱讀
- Clojure Programming Cookbook
- Maven Build Customization
- Android Studio Essentials
- 基于免疫進(jìn)化的算法及應(yīng)用研究
- Visual Basic學(xué)習(xí)手冊
- Mastering Predictive Analytics with Python
- Spring+Spring MVC+MyBatis整合開發(fā)實(shí)戰(zhàn)
- 從Excel到Python:用Python輕松處理Excel數(shù)據(jù)(第2版)
- Learning Vaadin 7(Second Edition)
- Visual Basic程序設(shè)計(jì)實(shí)驗(yàn)指導(dǎo)(第二版)
- Practical Game Design with Unity and Playmaker
- Spring Boot+MVC實(shí)戰(zhàn)指南
- 創(chuàng)意UI:Photoshop玩轉(zhuǎn)APP設(shè)計(jì)
- Mockito Essentials
- 零基礎(chǔ)看圖學(xué)ScratchJr:少兒趣味編程(全彩大字版)