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::
sum of 5 and Ten is" + NUM1 + num2; -"The sum of 5 and is 510""The sum of 5 and Ten is" + (NUM1 + num2); -"The sum of 5 and is 15" (shown to do the number calculation) and compare above3. Logical judgment of String (Boolean)The ternary operation in JSThe special case of the division parameter in JS (Infinity Infinity)alert (5/nan); NaNalert (infinity/
Binaryfloating-point arithmetic,
Ansi/ieee Std. 754-1985 (IEEE, New York).
The IEEE 754 standard includes not only positive and negativesign-magnitude
Numbers, but also positive and negative zeros, positive and negativeinfinities,
and a special Not-a-number value (hereafter abbreviated as "NaN"). The
NaN value is used to represent the result of certain invalid Operationssuch as
Dividing zero by zero.
A floating-point number type includes a float type and a double type. Corresponds to the 32-bit
Nan is a value type, and it is also a number. It means not a number, and this all knows what it means. The value is special, especially if Nan is a digit and is a number that is not equal to any number.
Three NaN valuesis a special value that represents the non-number (not a numbers)Type conversion fails to return Nane.g. to convert a word blue to a numeric value will fail because there is no equivalent valueNaN does not equal himselfThat is, Nan = = Nan is FalseJudge Nan using isNaN ();
Web e
);
var num5 = parseint ("a"); 70-decimal
var num6 = parseint ("0xf"); 15 16 to 15
8, the use of the number object
var num1 = number ("Hello world!"); NaN
var num2 = number (""); 0 empty string can be converted to 0 this parseint () is not the same as
var num3 = number ("000011"); One
var num4 = number (true); 1
9. Nan Usage
Alert (nan = = nan); False
alert (isNaN (NaN)); True
alert (isNaN); False is a number
alert (isNaN ("ten")); ca
Infinity (positive infinity), exceeding negative range, output-infinity (negative infinity)
[4.3.3.2]+-infinity cannot participate in numerical calculations
[4.3.3.3] Number.max_value+1!= Infinity, because the computer save up
/*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
easily accessed. The advantage of script engine cache means that you do not need to recompile the template as byte code.AspscriptfilecachesizePurpose: This attribute specifies the number of pre-compiled script files to be cached. If it is set to 0, no script files are cached. If it is set to 4294967295, all script files are cached. This attribute is used to adjust the performance, depending on the number of available memory and script file transfers.Note: When the database is configured, the va
number generated by the calculation is greater than number. max_value, it will be assigned the value number. positive_infinity, meaning no numerical value exists. Similarly, if the generated value is smaller than number. min_value, the value number. negative_infinity is also assigned, meaning that no numeric value exists. If the return value is an infinity value, the generated result cannot be used for other computations.
In fact, a special value r
double or float to represent infinity. As we learned in school, the infinite plus 1 is still infinite. If I is initialized to infinity before the loop starts, the terminate condition test (I = I + 1) is calculated as true, so that the loop will never end.
You can use any floating-point arithmetic expression that is computed as infinity to initialize I. For examp
problem. How does it feel changed after translation? Success ...)
Input: There is a n-meter-long wood, and a price table, the table is as follows:
Length I 1 2 3 4 5 6...
Price Pi 1 5 8 9 10 17...
Obviously, wood with a length of 1 meter can be bought for 1 yuan, and wood with a length of 5 meters can be sold for 10 yuan, and so on.
Output: Find a cut method to make the most money.
Obviously, the main idea of recursion is that after I cut a knife, I divided it into two sections. I sold it at th
"Nan"
Nan
False
Number object
Infinity
"Infinity"
Infinity
True
Number object
-Infinity
"-Infinity"
-Infinity
True
Number object
Value
Numeric string
Unchanged
number, and the special value is used to denote infinity ...Feel this part of the focus is to understand the floating point machine representation, as long as the clear conversion rules, can complete floating-point number and decimal decimal conversion is OK ... There is also a point where we can see the relationship between integers and floating-point numbers ...2.44 roundingRounding here by default is rounded to even, also known as the closest roun
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.