+1 . http://dev.mysql.com/doc/refman/5.0/en/problems-with-float.html



On Wednesday, May 1, 2013 8:18:03 PM UTC+2, Derek wrote:
>
> Comparing floats for equality is an issue with MySQL. Floats are rarely 
> equal, since the internal representation can be different than the actual 
> number. You'd want to use a different data type, or make your comparison a 
> greater than or less than.
>
> On Wednesday, May 1, 2013 6:59:27 AM UTC-7, AnnG wrote:
>>
>> Hi,
>>
>> I have a DAL query which works OK when selecting integer 'float' fields 
>> (eg 4.0, 5.0, 6.0)  (I'm using a MySQL database), but does not select rows 
>> containing actual float numbers (eg 6.3).
>>
>> Here is the code
>>
>> for table_row in db((db.field_phenotype.field_phenotype_pk == db.
>> scaninstance_fieldphenotype.field_phenotype_fk) & (db.
>> scaninstance_fieldphenotype.scaninstance_fk == db.scaninstance.
>> scaninstance_pk) & (db.scaninstance.patient_fk == self.patient_id) 
>>
>> & (db.scaninstance.age_months == age_months)  ##### goes wrong here
>>
>> ).select(db.field_phenotype.name, db.scaninstance_fieldphenotype.
>> field_phenotype_value):
>> ...
>>
>> ... The 'age_months' variable is copied from an earlier query from the 
>> same table/field. That earlier query works fine, returning all floats - 
>> which print out fine on my web-page.
>> The query shown above only matches with rows where the 
>> db.scaninstance.age_months 
>> is an integer (converted to a float) eg 4.0, 5.0, 64.0
>> but not for actual floats eg 6.3
>>
>> Can anyone help??
>>
>> Regards
>>
>> Ann
>>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to