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

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.

主站蜘蛛池模板: 西安市| 尉氏县| 丹江口市| 阳高县| 青冈县| 抚顺县| 行唐县| 洛扎县| 扬州市| 行唐县| 天门市| 互助| 桂林市| 高碑店市| 渝北区| 新营市| 荥经县| 句容市| 四会市| 山东省| 武威市| 长垣县| 中超| 县级市| 龙川县| 张家界市| 基隆市| 姜堰市| 临猗县| 新巴尔虎左旗| 西充县| 伽师县| 金湖县| 光山县| 方城县| 土默特右旗| 鹰潭市| 永善县| 林芝县| 怀来县| 巴里|