While maybe different formatting, how is that wrong? Remember, if you've 
declared the columns to be of type real then they're stored as an 8 byte binary 
floating point number. There is no exact representation of .05 in binary: so 
it's giving you all the digits that are stored. See #16 in the FAQ 
http://www.sqlite.org/faq.html#q16


-----Original Message-----
From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On 
Behalf Of Iulian Onofrei
Sent: Monday, January 22, 2018 7:01 AM
To: sqlite-users@mailinglists.sqlite.org
Subject: Re: [sqlite] .DUMP displays floats differently from SELECT

Hi,

This is clearly a bug, as it outputs incorrect and different output from the
previous versions.

I have a "REAL" column with float values having up to 2 decimals, and using
".dump" with the latest version incorrectly converts them like this:

"0.0" -> "0.0"
"0.05" -> "0.050000000000000002775"
"0.06" -> "0.059999999999999997779"
"0.07" -> "0.070000000000000006661"
"0.08" -> "0.080000000000000001665"
"0.09" -> "0.089999999999999996669"
"0.1" -> "0.10000000000000000555"
"0.11" -> "0.11000000000000000055"
"0.12" -> "0.11999999999999999555"
"0.13" -> "0.13000000000000000444"
"0.15" -> "0.14999999999999999444"
"0.16" -> "0.16000000000000000333"
"0.17" -> "0.17000000000000001221"
"0.18" -> "0.17999999999999999333"
"0.19" -> "0.19000000000000000222"
"0.21" -> "0.20999999999999999222"
"0.22" -> "0.22000000000000000111"
"0.23" -> "0.23000000000000000999"
"0.24" -> "0.23999999999999999111"
"0.25" -> "0.25"
"0.26" -> "0.26000000000000000888"
"0.27" -> "0.27000000000000001776"
"0.28" -> "0.28000000000000002664"
"0.29" -> "0.28999999999999998001"
"0.3" -> "0.29999999999999998889"
"0.32" -> "0.32000000000000000666"
"0.33" -> "0.33000000000000001554"
"0.37" -> "0.36999999999999999555"
"0.38" -> "0.38000000000000000444"
"0.4" -> "0.4000000000000000222"
"0.41" -> "0.40999999999999997557"
"0.43" -> "0.42999999999999999333"
"0.44" -> "0.44000000000000000222"
"0.45" -> "0.4500000000000000111"
"0.46" -> "0.46000000000000001998"
"0.49" -> "0.48999999999999999111"
"0.5" -> "0.5"
"0.51" -> "0.51000000000000000888"
"0.52" -> "0.52000000000000001776"
"0.54" -> "0.54000000000000003552"
"0.56" -> "0.56000000000000005329"
"0.57" -> "0.56999999999999995115"
"0.58" -> "0.57999999999999996003"
"0.6" -> "0.59999999999999997779"
"0.61" -> "0.60999999999999998667"
"0.65" -> "0.6500000000000000222"
"0.67" -> "0.67000000000000003996"
"0.7" -> "0.69999999999999995559"
"0.73" -> "0.72999999999999998223"
"0.75" -> "0.75"

I rely on dumps to track changes to some databases, so this breaks it
completely, and I currently had to pin sqlite to an older version which
isn't desired.

Thank you,
iulianOnofrei



--
Sent from: http://sqlite.1065341.n5.nabble.com/
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to