c浮点型变量初始值整数
[rps-include post=6522]
[rps-include post = 6522]
Php provides different numeric variable types. In this tutorial we will look them in detail. The numeric types available in Php are listed below.
PHP提供了不同的数字变量类型。 在本教程中,我们将详细介绍它们。 以下列出了Php中可用的数字类型。
- Integer 整数
- Float浮动
- Double双
Numeric values are used mainly used for mathematical calculations. If we will use numbers just like id or school number better way is using string but if we will made calculations, dividing etc. we need numeric variable types.
数值主要用于数学计算。 如果我们像id或school number一样使用数字,更好的方法是使用字符串,但是如果我们进行计算,除法等,我们需要数字变量类型。
整数 (Integer)
Integer type variables holds non floating numeric and calculable values. We can use integer variables to hold count, round type situations. Here we will make an example about integer. We will use $count
integer variable to hold count of students.
整数类型变量保存非浮点数字和可计算的值。 我们可以使用整数变量来保存计数,舍入类型的情况。 这里我们将以整数为例。 我们将使用$count
整数变量来保存学生人数。
$count = 23;
Each integer variable holds 4 byte in the memory. The maximum and minimum values changed according to system architecture like 32 or 64 bit.
每个整数变量在内存中保留4个字节。 最大值和最小值根据系统架构(例如32位或64位)而变化。
32 bit
32位
Minimum: -2147483648
最低:-2147483648
Maximum: 2147483647
最多:2147483647
64 bit
64位
Minimum: -9223372036854775808
最低:-9223372036854775808
Maximum: 9223372036854775807
最多:9223372036854775807
浮点 (Floating Point)
Integers have vast use cases but it is not enough to express all numeric cases. Float type of variables are used to store floating point numbers. In this example we will store price of a laptop with a floating point number. We will use point .
to specify decimal and floating point part like below.
整数有大量用例,但不足以表示所有数值用例。 浮点类型的变量用于存储浮点数。 在此示例中,我们将使用浮点数存储笔记本电脑的价格。 我们将使用point .
指定小数和浮点部分,如下所示。
$laptop_price=1099.99;
Another floating point definition syntax is using e
for 64 bit IEEE format like below.
另一种浮点定义语法是将e
用于64位IEEE格式,如下所示。
$a=1.2e3;
[rps-include post=6522]
[rps-include post = 6522]
翻译自: https://www.poftut.com/numeric-variable-types-like-integer-float-double/
c浮点型变量初始值整数