本参考资料用于Processing 3.0+。 如果你使用的是前一版本,请在使用软件帮助菜单内的参考资料。. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.



 double a;

   //Declare variable 'a' of type double
a = 1.5387D;

    // Assign 'a' the value 1.5387 double b = -2.984D;

// 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 afloat 
描述 Datatype forfloating-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 afloat, 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.
 double var double var = value 
var variable name referencing thefloat
value anyfloating-point value
相关 float

Updated on October 2, 2018 05:02:16pm EDT