c浮点型变量初始值整数_Php –数值变量类型,例如整数,浮点数,双精度

c浮点型变量初始值整数

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]

LEARN MORE  How To Convert List To String in Python?
了解更多如何在Python中将列表转换为字符串?

翻译自: https://www.poftut.com/numeric-variable-types-like-integer-float-double/

c浮点型变量初始值整数

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值