Friday, June 29, 2007

Numbres in javascript

Douglas Crockford video (13:40)
  • Only one number type (No integers)
  • 64-bit floating point
  • IEEE-754 (aka “Double”)
  • Does not map well to common understanding of arithmetic:
  • 0.1 + 0.2 = 0.30000000000000004

Tehat az Crackford tanacsa, hogy ha penzzel szamolunk akkor szorozzuk fel szazzal az operandusokat, vegezzuk el a szamitast majd az eredmenyt osszuk vissza szazzal.