首页 > 文档 > double双精度浮点型
2017
07-15

double双精度浮点型

Name

double双精度浮点型

   

Examples

double a; // Declare variable ‘a’ of type float

a = 1.5387; // Assign ‘a’ the value 1.5387

double b = -2.984; // Declare variable ‘b’ and assign it the value -2.984

double c = a + b; // Declare variable ‘c’ and assign it the sum of ‘a’ and ‘b’

float f = (float)c; // Converts the value of ‘c’ from a double to a float

Description

描述

Datatype for floating-point numbers larger than those that can be stored in a float. A float is a 32-bit values that can be as large as 3.40282347E+38 and as low as -3.40282347E+38. A double can be used similarly to a float, but can have a greater magnitude because it’s a 64-bit number. Processing functions don’t use this datatype, so while they work in the language, you’ll usually have to convert to a float using the (float) syntax before passing into a function.

floating-point 数字的数据类型大于可存储在浮点型中的数据。float 是一个32位的值, 可以是多达3.40282347E+38 和低至 3.40282347E + 38。双精度可以类似于浮点型, 但可以具有更大的大小, 因为它是一个64位的数字。处理函数不使用此数据类型, 因此, 当它们在语言中工作时, 通常必须在传递到函数之前使用 (float) 语法转换为浮点型。

Syntax

语法

double var

double var = value

Parameters

参数

var

variable name referencing the float

value

any floating-point value

Related

相关

float



最后编辑:
作者:卡萨布兰卡
这个作者貌似有点懒,什么都没有留下。

留下一个回复

你的email不会被公开。