I started this thread SQL Server float data type understanding
And the following question is partially related to it, so I bring it up back here.
Documents and SQL Server users say that float(8 bytes) and real(4 bytes) data types are for approximate use only. I can see that via use of SQL Server Management Studio and some simple queries like
declare @f float=0.000123456789123456789;
select @f;
where the output becomes 0.000123456789123457 (auto round-off error) as the precision is set to 15 non-zero digits and after the decimal point.
I think the output by SQLServer Management Studio is implementation defined. Because the byte series fed into the system is transformed into a long bit integer then cast into a float type of the same precision depending upon the language being used to implement the system and the casting functions. If the main cause lies right at this point then I think the approximation issue can be fixed. That is to reprogram the functions with data streaming to get back the exact values as previously input.
However, I still wish to learn what other particular examples you know about that can exhibit their approximate error symptoms ?
I still do have another question mentioned also in my previous thread about the byte order and its transformation of float and real data type when it is being processed in either big and little endian systems. If someone could offer me some ideas, it would be really awesome. My take on this is that float is fixed on little endian, real is not an exception because they are different only in the storage. Their functions are totally the same. Yet confirmation from experts over this is badly needed.
Aucun commentaire:
Enregistrer un commentaire