Although a floating-point value may be equal in magnitude to an integer, logically they are different due to the typing of the value. However, typing in JavaScript is weak and a floating point value and an integer value may well compare equal where they might not have in other languages.
If the JavaScript language ever acquires a stronger typing facility, some scripts may fail on this point.
ECMA 262 edition 2 - section - 7.7.3
ECMA 262 edition 3 - section - 7.8.3
O'Reilly JavaScript Definitive Guide - page - 36
Prev | Home | Next |
Floating constant | Up | Floating point arithmetic |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |