1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-24 13:33:01 +03:00
Files
libxml2/result/XPath/expr/functions
Nick Wellnhofer 4bebb030db Rework XPath rounding functions
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.
2017-05-31 15:38:42 +02:00

169 lines
3.2 KiB
Plaintext

========================
Expression: true()
Object is a Boolean : true
========================
Expression: false()
Object is a Boolean : false
========================
Expression: number("1.5")
Object is a number : 1.5
========================
Expression: number('abc')
Object is a number : NaN
========================
Expression: -number('abc')
Object is a number : NaN
========================
Expression: floor(0.1)
Object is a number : 0
========================
Expression: floor(-0.1)
Object is a number : -1
========================
Expression: floor(-0)
Object is a number : 0
========================
Expression: floor(0)
Object is a number : 0
========================
Expression: floor(5.2)
Object is a number : 5
========================
Expression: floor(-5.2)
Object is a number : -6
========================
Expression: floor(100000000000000000000)
Object is a number : 1e+20
========================
Expression: floor(-100000000000000000000)
Object is a number : -1e+20
========================
Expression: floor(0 div 0)
Object is a number : NaN
========================
Expression: floor(1 div 0)
Object is a number : Infinity
========================
Expression: floor(-1 div 0)
Object is a number : -Infinity
========================
Expression: ceiling(0.1)
Object is a number : 1
========================
Expression: ceiling(-0.1)
Object is a number : 0
========================
Expression: ceiling(-0)
Object is a number : 0
========================
Expression: ceiling(0)
Object is a number : 0
========================
Expression: ceiling(5.2)
Object is a number : 6
========================
Expression: ceiling(-5.2)
Object is a number : -5
========================
Expression: ceiling(100000000000000000000)
Object is a number : 1e+20
========================
Expression: ceiling(-100000000000000000000)
Object is a number : -1e+20
========================
Expression: ceiling(0 div 0)
Object is a number : NaN
========================
Expression: ceiling(1 div 0)
Object is a number : Infinity
========================
Expression: ceiling(-1 div 0)
Object is a number : -Infinity
========================
Expression: round(0.1)
Object is a number : 0
========================
Expression: round(5.2)
Object is a number : 5
========================
Expression: round(5.5)
Object is a number : 6
========================
Expression: round(5.6)
Object is a number : 6
========================
Expression: round(-0.1)
Object is a number : 0
========================
Expression: round(-5.2)
Object is a number : -5
========================
Expression: round(-5.5)
Object is a number : -5
========================
Expression: round(-5.6)
Object is a number : -6
========================
Expression: round(0.5)
Object is a number : 1
========================
Expression: round(-0.5)
Object is a number : 0
========================
Expression: round(100000000000000000000)
Object is a number : 1e+20
========================
Expression: round(-100000000000000000000)
Object is a number : -1e+20
========================
Expression: round(0 div 0)
Object is a number : NaN
========================
Expression: round(1 div 0)
Object is a number : Infinity
========================
Expression: round(-1 div 0)
Object is a number : -Infinity