floating-point number is double)
float 4 bytes (the 1th bit is the sign bit, the next 8 bits represent the exponent, and the next 2 bits indicate the mantissa)
NBSP;D Ouble 8 bytes (The 1th bit is the sign bit, the next 11 bits represent the exponent, then the next 52 bits represent the mantissa)
Reference type (reference type):
Class
Interface
Array
Null
binary i
First, the number of the wording3.14 2345.789 . 333333333333333333 6.02e23 // 6.02x10 1.4738223E-32 // 1.4738223x10 Ii. usage of the Math objectMath.pow (2,53)//= 9007199254740992:2 to the PowerMath.Round (. 6)//= = 1.0:round to the nearest integerMath.ceil (. 6)//= = 1.0:round up to an integerMath.floor (. 6)//= = 0.0:round down to an integerMath.Abs (-5)//= = 5:absolute valueMath.max (x, Y, z)//Return the largest argumentMath.min (x, Y, z)//Return the smallest argumentMath.rand
); // false Alert (IsNaN (NaN)); // true Alert (IsNaN (ten)); // false? is a number Alert (IsNaN ("ten")); // false? Can is converted to number Alert (IsNaN ("Blue")); // true? Cannot is converted to a number Alert (IsNaN (true)); // false? can converted to number 110, the system maximum numbervar result = Number.MAX_VALUE + 1; Alert (isfinite (result)); // false11, Infinity
First, Q: please for i = = i + 1; provide a declaration to make the condition valid. Analysis: a number never equals 1 of its own, right? What if the number is infinitely large? Java enforces the use of IEEE binary floating-point arithmetic standard IEEE 754, which allows you to represent infinity with a double or float. Infinity plus 1 is infinitely large. If I is declared as
). Boolean typeA Boolean type (BOOL) represents a condition that has two values: True and False. Where true indicates that the condition is set,Is true, and false indicates that the condition is not valid, which is false. A Boolean type is a subtype of an integer type. In fact, true is 1,False is 0. Thus, you can also use Boolean types to participate in mathematical operations, as are the results of using 1 and 0 to participate in the operation. Floating-point typesA floating-point type (float)
expression:
(long) Math.floor (A + 0.5d)
The special case is as follows: If the argument is NaN, then the result is 0. If the result is a negative infinity or any value less than or equal to long.min_value, the result is equal to the Long.min_value value. If the argument is positive infinity or any value greater than or equal to long.max_value, the result is equal to the Long.max_value value.
parameter:
/*Name:prime algorithm to find the minimum spanning tree (adjacency matrix)Copyright:Author: A clever clumsyDATE:25/11/14 13:38Description:The general algorithm and the minimum heap optimization algorithm for the minimum spanning tree (adjacency matrix) of the prime algorithm are implemented.*/#include #include #define MAX 2000//MAX Vertex count#define INFINITY 999999//Infinitytypedef struct minheap{int num;//store vertex numbersint W; The distance fr
. Of course, if it's 0.15+0.15 or 0.05+0.25, then it's fine. Therefore, do not test specific floating-point values.Range of values:Due to memory limitations, ECMAScript does not save all the values in the world, and the minimum value is generally preserved:number.min_value , the maximum value is saved in Number.MAX_VALUE . The out-of-range translates into a special Infinity value, or -infinity (negative
logically represents an empty object pointer, so typeof NULL returns "Object";② actually undefined values are derived from null values, so ECMA-262 specifies that the equality test for them returns true, that is, NULL = = undefined true;③ when a defined variable is used to hold an object in the future, it is better to initialize the variable to null.2.4 Boolean typeAny data type can call the Boolean () function, and in some flow control statements (such as the IF statement, the while statement,
Data typeEmphasis: in arithmetic expressions, byte,short,char all become int, and then all variables are converted to the highest-level type in their calculation.Basic data types and reference typesBasic data types: Byte 1, short 2, int 4, long 8, char 2 (equivalent to unsigned integer), float 4, double 8. BooleanInteger default int type long L = 999999999999 compile error, default int is out of int range, long L = 99999999999LFloating-point number default double type, 8888.8f for float typeOnly
First, the type conversion method and should pay attention to the question:
1.Convert to Boolean:(1) with two-time non-operation(!):!! 5 ==> True(2) with a Boolean constructor:New Boolean (5) = = > TrueValue is converted to a Boolean type ofFalse:0,+0,-0,NaN,""(Empty string), Undefined,nullIn addition to the value of the above other values after the conversion forTrue, it is necessary to mention in particular:"0", New Object (), function () {}2.Convert to String type:(1) plus an empty string"":1
is the problem of rounding error. For example: 0.1 + 0.2 = 0.3 (15 0) 4
[4.3.3] The value range in js is Number. MIN_VALUE (5e-324) -- Number. MAX_VALUE (1.7976931348623157e + 308)
[4.3.3.1] If a positive number range is exceeded, the output Infinity (positive Infinity) is exceeded, and the output Infinity (negative Infinity
values in the world. The minimum value that ECMAScript can represent is saved in Number.min_value--in most browsers, the value is 5e-324; The maximum value that can be represented is saved in Number.max_vlaue--in most browsers, This value is 1.7976931348623157e+328. If a calculation results in a value that exceeds the range of JavaScript values, the value is automatically converted to a special infinity value. Specifically, if the value is negative,
default setting), NULL as the initial value of the variable of the reference type (explicitly set)Boolean typeThe Boolean type has only two literal values of true,false. But these two values are not the same as numeric values, so true is not necessarily equal to 1, and false is not necessarily equal to 0.To convert a value to a Boolean equivalent value, there are two scenarios:
One is an explicit conversion-Call type conversion function Boolean ()
One is an automatic conversion-if
sum function returns the sumThe floor (number) function returns the maximum number (closest to positive infinity) not greater than the integer of a parameter)The ceiling (number) function returns the minimum number (closest to negative infinity) not small to the integer of the parameter)The round (number) function returns an integer closest to the parameter. If there are two such numbers, return the one cl
): detects whether a value is Nan. IsNaN () detects if the value is a non-numeric value, and returns True if the values are Nan, otherwise false.
isfinite (value): detects whether a value is infinite. If value is Nan or the number of +infinity or-infinity, Isfinite () returns false.Global PropertiesInfinity: The Infinity property is used to hold numeric val
contain a decimal point, and must have at least one digit after the decimal.[4.3.2.1] because the floating-point value needs to save twice times the integer value, so JS will lose no chance to convert the floating-point value to an integer value, if the decimal point is not followed by any number or the floating-point value itself is an integer, this value will be saved as an integer value.[4.3.2.2] The highest precision for floating-point values is 17 decimal places[4.3.2.3] for a large or ver
next-generation values.This chapter describes the atomic elements of JavaScript programs, which are simple value types and operators that can handle these values .
Numbers-JavaScript uses fixed-length bits to store digital---JavaScript USes a fixed number of bits, namely of them, to store a single number value. Can Represe Nt 264different numbers, which is on quintillion (an-with-zeros after it). Only 2 of 64 times a different number of words! does not refer to so many positive integers. -
returns the value of the node string converted to a number and
The floor (number) function returns the maximum of integers that are less than arguments (closest to positive infinity)
The ceiling (number) function returns the minimum of an integer that is not less than the argument (closest to the negative infinity)
The round (number) function returns the integer closest to the argument. If there are two su
", 6], ["H", 7], ["I", 8], ["J", 9], ["K",], ["L" , one], ["M", "," ["N", "], [" O ","], ["P", ["Q",], ["R",], ["s",], ["T",], ["U",], ["V",], ["W", [x], ["Y",], ["Z", 25]]Lazy Enumerator
The lazy enumerator can have a large collection of selected enumerations.
Try this:
(1..float::infinity). Select {|n| n% 3 = 0}.first (10)Will always run ... select will not end.
At this point, you can create a lazy enumerator:
>> (1..float::
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.