mirror of
https://github.com/GNOME/libxml2.git
synced 2025-10-23 10:27:58 +08:00

Use the C library's floor and ceil functions. The old code was overly complicated for no apparent reason and could result in undefined behavior when handling NaNs (found with afl-fuzz and UBSan). Fix wrong comment in xmlXPathRoundFunction. The implementation was already following the spec and rounding half up.
43 lines
640 B
Plaintext
43 lines
640 B
Plaintext
true()
|
|
false()
|
|
number("1.5")
|
|
number('abc')
|
|
-number('abc')
|
|
floor(0.1)
|
|
floor(-0.1)
|
|
floor(-0)
|
|
floor(0)
|
|
floor(5.2)
|
|
floor(-5.2)
|
|
floor(100000000000000000000)
|
|
floor(-100000000000000000000)
|
|
floor(0 div 0)
|
|
floor(1 div 0)
|
|
floor(-1 div 0)
|
|
ceiling(0.1)
|
|
ceiling(-0.1)
|
|
ceiling(-0)
|
|
ceiling(0)
|
|
ceiling(5.2)
|
|
ceiling(-5.2)
|
|
ceiling(100000000000000000000)
|
|
ceiling(-100000000000000000000)
|
|
ceiling(0 div 0)
|
|
ceiling(1 div 0)
|
|
ceiling(-1 div 0)
|
|
round(0.1)
|
|
round(5.2)
|
|
round(5.5)
|
|
round(5.6)
|
|
round(-0.1)
|
|
round(-5.2)
|
|
round(-5.5)
|
|
round(-5.6)
|
|
round(0.5)
|
|
round(-0.5)
|
|
round(100000000000000000000)
|
|
round(-100000000000000000000)
|
|
round(0 div 0)
|
|
round(1 div 0)
|
|
round(-1 div 0)
|