|
[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message] Numeric type promotionJohn Snelson jsnelson at sleepycat.comThu Oct 19 14:30:24 PDT 2006
Hi All, I'm having a hard time understanding the logic behind the XQuery specification's numeric type promotion rules. There are three basic numeric types decimal, float and double. The float and double types are based on IEEE 754-1985 floating point numbers, and as such have certain deficiencies - like upper and lower limits on their values, and problems exactly representing common base 10 numbers. The decimal type, on the other hand, is an arbitrary precision decimal number, and can accurately represent any (base 10) number of any size. Why then do the numeric type promotion rules specify that decimal is converted to float or double, and not the other way around? XQuery users are being forced to lower the precision of their numeric calculations by performing type promotion this way around! I'm sure that the extra state that is available in float and double came into the decision - there is no way to represent Nan, INF, -INF or -0 in decimal. However, mathematically -0 does not exist - it is an artifact of the way that the numbers are stored, and the other three are really only error states. I'm sure the working group discussed these issues, I'm just wondering why the decisions were made. John
|
Purchase Stylus Studio Online Today!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






