Hi Jeremy, There is no integer type in JavaScript.
There is Number type which is defined to be double precision floating-point number. ECMA-262 defined ToInteger(x) operation in section 9.2: roughly it is just sign(x) * floor(abs(x)) plus several special cases for NaN, -0, and infinities. Integer type in V8 API should be treated as a convenient way of representing and accessing result of this operation. It does not extend underlying JavaScript type system, it just wraps value of Number type. -- Vyacheslav Egorov On Tue, Dec 14, 2010 at 1:21 AM, Jeremy <[email protected]> wrote: > I noticed that Integer::Value() returns a 64-bit integer. > Furthermore, there is a distinct Int32 type which is presumably for 32- > bit integers. But there doesn't seem to be any way to actually put a > 64-bit integer into an Integer - Integer::New() takes a 32-bit > integer. > > So does V8 support 64-bit integers, or not? Is there some secret way > to get a 64-bit integer into an Integer type? I want to avoid the > precision loss that I would get from putting it into a Number in the > case where |value| > 2^53. Is that possible or should I just allow my > 64-bit ints to be promoted to doubles and represent them as a Number? > > Thanks, > Jeremy > > -- > v8-users mailing list > [email protected] > http://groups.google.com/group/v8-users > -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
