• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Select on Double value during saveChanges
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Select on Double value during saveChanges


  • Subject: Re: Select on Double value during saveChanges
  • From: Musall Maik <email@hidden>
  • Date: Sat, 01 Feb 2014 16:32:47 +0100


Am 01.02.2014 um 14:19 schrieb Jeffrey Schmitz <email@hidden>:

Hello List,

   I have an operation that updates many attributes on about 150 rows of data in a TeamInfo table.  When doing a saveChanges operation it generates a SELECT statement like the one shown below for about 50 of the rows before it hits the one shown below that raises an exception.  All the previous SELECT's find a single row, but this particular one finds none.

The reason it's not finding a row is because of the value it's generating for finding a Double typed value.  For some reason it's using 72.60000000000001 but the value in the database is showing 72.6 (see bottom image).  I went through the debugger and stopped to the line where the value is set, and it is setting it to 72.6 (see image below).  

Sounds like some kind of nasty rounding/floating point representation problem going on so I'm wondering what I could do to guard against this?   

Switch to BigDecimal. Do not use floating point values with equality checks.

Maik

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Select on Double value during saveChanges
      • From: Markus Ruggiero <email@hidden>
    • Re: Select on Double value during saveChanges
      • From: Jeffrey Schmitz <email@hidden>
  • Next by Date: Re: Select on Double value during saveChanges
  • Next by thread: Re: Select on Double value during saveChanges
  • Index(es):
    • Date
    • Thread