Re: [xml] XPath fix



Richard Jinks wrote:

Presumably, also functions to set the sign explicitly (i.e., so I can set a
value to -0)?

That is not necessary. You can assign -0.0 to a floating-point variable in C.

As an aside, as you seem to have a good understanding of floating point
numbers, could you confirm that both ceiling(-0.1) and round(-0.1) should
return -0 and not +0?

That is correct. According to IEEE 754, the sign is preserved when rounding
numbers, including zero.

In general, the sign rules that applies to normal numbers also applies to
zero. The only exceptions are the following two cases:

 x + x = -0 for x = -0
       = +0 for x = +0
       = +0 for x != 0

 sqrt(-0) = -0



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]