首页 > lang > type > float 
 en fr de es it nl pl pt pt_BR mk sq ca hu cs tr ar fa id vi ko ja ru zh eo
前一个  下一个  编辑  重命名  撤销  搜索  管理  
文档  
警告! 该页面未翻译。  参见英文版 
Float
DIM Var AS Float

This native datatype represents a double floating point value, i.e. a eight bytes floating point value.

The value of a Float is a number between -8.98846567431105E+307 and +8.98846567431105E+307

The precision of Float is 52 binary digits, which is 16 decimal digits (2^-52). This means: if add to 1.0 a (positive) number which is less than 2E-16 than the result will be exactly 1.0

Example

DIM x AS Float = Sin(0.32)
DIM y AS Float = x - (0.32 - 0.32 ^ 3 / (2 * 3))

PRINT x;;y

0.314566560616 2.789394945107E-5

Overflow during Float arithmetic operations is not detected! Instead the result is set to 1E+2147483647 resp -1E+2147483647

If such an overflowed number is used in further expressions, then the execution stops and a message window shows "Mathematic error". But the value of a Float can be compared against maxfloat or minfloat.

CONST maxfloat AS Float = +8.98846567431105E+307
CONST minfloat AS Float = -8.98846567431105E+307
...
IF y > maxfloat OR y < minfloat THEN
  PRINT "Float y overflow"
ELSE
  x = y / 23000
ENDIF

参见

Datatypes, Single, Arithmetical Functions, Trigonometric Functions, Logarithms & Exponentials Functions