Recursive

adjective: see 'Recursive'

Main menu

Skip to primary content
Skip to secondary content
  • Home
  • Contact
  • Me
  • Myself & I
  • My Projects
  • Wishlists

Tag Archives: hack

JavaScript Bug – Modulo of small numbers

Posted on 9th Nov '07 by Jez

It seems that there is a problem with the modulo function, ‘%’, in JavaScript.

For example: 10 % 0.1 should equate to zero but comes out as 0.09999999999999945 probably due to some internal floating-point rounding errors.

Easy solution (a hack really): Multiply both numbers by 1000 before using the modulo function.

Posted in Code, Tech, Tips, Web | Tagged bug, Code, hack, javascript, js, Tech, Web

Tags

Asides Blogosphere broadband browser BT bug Code Eco Events firefox fx Google Humour javascript Jazzle js Kenya Media Modding musing Musings natwest N F Hell Not Mine obesity online online security Opinion overweight Personal Photography Rant Recommendations Religion review Reviews security SketchUp Society Tech tip Tips uk Videos Web

Archives

Blogroll

  • Vukutu

Friends

  • Fraser Davidson
  • Rebecca Wilcox
  • Richie Pearce
  • Sacconi Quartet
  • UKD1

Of Note

  • Frequency Decoder

Meta

  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org
Proudly powered by WordPress