Questenaتمرینی که نشان می‌دهد بعد چه چیزی را مرور کنید
سؤال 6

Why can the test 0.1 + 0.2 === 0.3 evaluate to false in JavaScript?

  1. Some decimal fractions are inexact in binary floating-pointپاسخ درست
  2. Strict equality rounds both sides to whole numbers
  3. Every JavaScript integer is stored approximately
  4. Addition always converts decimal numbers to strings

توضیح

Number arithmetic uses double-precision binary floating-point, and fractions such as 0.1 may lack an exact binary representation. This does not mean every integer or every decimal operation is inaccurate, so that broader explanation overstates the limitation.

ادامهٔ این آزمون

شروع تمرین
سؤال 6: Why can the test 0.1 + 0.2 === 0.3 evaluate to false in… · JavaScript Fundamentals · Questena