Testing with SQLiteStudio I get 79.8 + 744.8 = 824.59999999, so I guess SQLite find that different than 824.6
Maybe Xojo is rounding back the 824.5999999 to 824.6
Edit: using SQLite CLI I get:
sqlite> select *, (column1 + column2) from sum where (column1 + column2) <> column3 ;
79.8|744.8|824.6|824.6
and
sqlite> select *, (column1 + column2) from sum where (column1 + column2) = column3 ;
5.8|6.8|12.6|12.6
the CLI is reporting 824.6 visually and it say is different than 824.6, then row2 is saying that 12.6 is equal to 12.6
[quote=411893:@Jeff Tullin]Good to see you have a workaround.
As a general rule, don’t write code that compares two floats for equality.
They can vary by very small amounts.[/quote]
Thanks Jeff, I learned that with this lesson.
Thank you Dave, you are correct the code was tested with the simple database (3 columns and 2 records) and it worked. But as you said if printf is going to be used is a better practice to compare “string” with “string”.
This also works:
select *, printf("%.1f", (column1 + column2)) as sum from test where sum <> printf("%.1f", column3) ;