Skip to main content

Bug Tracker

Side navigation

#15100 closed bug (fixed)

Opened May 19, 2014 07:08AM UTC

Closed June 07, 2014 06:35PM UTC

isNumeric implementation of version 2.1.0 returns wrong results in Opera 12.17

Reported by: PachaG Owned by: gibson042
Priority: high Milestone: 1.12/2.2
Component: core Version: 2.1.0
Keywords: Cc:
Blocked by: Blocking:
Description

The isNumeric function of older (2.0.3) versions works correctly in Opera 12.17

$.isNumeric(1.5999999999999999) == false
$.isNumeric(1.59999) == true

The test page

http://jsfiddle.net/z2NYD/

Attachments (0)
Change History (3)

Changed May 19, 2014 01:55PM UTC by dmethvin comment:1

component: unfiledcore
milestone: None1.12/2.2
priority: undecidedhigh
status: newopen

Probably this commit: https://github.com/jquery/jquery/commit/68213f20bb5d5426f99bafde028ecab601a9d105

My guess is that since we're dealing with floating point the result ends up being ever-so-slightly negative. I just need to find an Opera 12.17 to prove it.

@gibson042 what do you think?

Changed May 19, 2014 04:10PM UTC by gibson042 comment:2

owner: → gibson042
status: openassigned

Looks like it's from loss of precision in a string cast for parseFloat... the fix will be almost certainly be replacing obj - parseFloat( obj ) >= 0 with !isNaN( obj - parseFloat( obj ) ).

Changed June 07, 2014 06:35PM UTC by Richard Gibson comment:3

resolution: → fixed
status: assignedclosed

Core: Work around loss of precision from parseFloat

Fixes #15100

(cherry picked from commit b6e99eb43c35a3cd048c5c56d31c7e871f299a77)

Changeset: e1192af8726bcd25da58aba64b20d89e919230b9