What is XQuery Numeric function in XML

In this we are going to explain XQuery Numeric function.
  • 1838

Numeric value function returns the numeric value of the node that is indicated by arguments. Function on  numeric value is given below.

  • ceiling Function

    The fn:ceiling function returns the smallest integer that is greater than the number argument.

Syntax of ceiling Function

fn:ceiling ( $arg as numeric?) as numeric?


Example of ceiling Function is ceiling(6.1)=6, ceiling(6.6)=6, ceiling(-6.1)=  -6, ceiling(())=().

  •  floor Function

    The fn:floor function returns the largest integer that is greater than the number argument. The result type depends the numeric type of the argument.

Syntax of floor Function

fn:floor ($arg as numeric?) as numeric?


Example of floor Function is  floor(6)=5, floor(6.1)=6, floor(6.7)=6, floor(-6.1)=-7,floor(-6.7)=-7, floor(())=().

  • round Function

    The fn:round function is used to round a numeric value to the nearest integer. 

Syntax of round Function

fn:round ( $arg as numeric?) as numeric?


Example of round  Function is round(5)=5, round(5.1)=5, round(5.5)=6, round(-5.5)=-5, round(-5.51)=-6.  

  • avg Function

    The avg function can also be used on duration values.

Syntax of avg Function

fn:avg ( $arg as numeric?) as numeric?


Example of avg Function is avg( (1, 2, 3, 4, 5) )=3, avg( (1, 2, 3, (), 4, 5) )=3.

  • min Function

    The fn:min function returns the minimum of the values in a sequence.

Syntax of min Function

fn:min ( $arg as numeric?) as numeric?


Example of min Function is min( (2, 1, 3.5, 4) )=1, min( ('a', 'b', 'c') )=a.

  • max Function

    The fn:min function returns the maxmum of the values in a sequence.

Syntax of max Function

fn:min ( $arg as numeric?) as numeric?

Example of max Function is max( (2, 1, 5, 4, 3) )=5, max( ('a', 'b', 'c') )=c.

Further Readings
 

You may also want to read these related articles: here
 
Ask Your Question 
 
Got a programming related question? You may want to post your question here
 

 

 

 

 

 

 

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.