- 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.
推薦閱讀
- Angular UI Development with PrimeNG
- 無代碼編程:用云表搭建企業(yè)數(shù)字化管理平臺
- Spring Boot+Spring Cloud+Vue+Element項(xiàng)目實(shí)戰(zhàn):手把手教你開發(fā)權(quán)限管理系統(tǒng)
- 三維圖形化C++趣味編程
- 深入淺出Windows API程序設(shè)計(jì):編程基礎(chǔ)篇
- SEO智慧
- Data Analysis with Stata
- Hands-On Microservices with Kotlin
- Mastering ServiceNow(Second Edition)
- Python算法從菜鳥到達(dá)人
- AI自動(dòng)化測試:技術(shù)原理、平臺搭建與工程實(shí)踐
- Software-Defined Networking with OpenFlow(Second Edition)
- 深入理解Java虛擬機(jī):JVM高級特性與最佳實(shí)踐
- VMware vSphere 5.5 Cookbook
- Python Penetration Testing Essentials