http://www.zorba-xquery.com/modules/excel/engineering ZC

Module Description
Before using any of the functions below please remember to import the module namespace:
import module namespace excel-engineering = "http://www.zorba-xquery.com/modules/excel/engineering";

This is a library module offering the same set of functions defined by Microsoft Excel, under Engineering Functions.

Author:

Sorin Nasoi

XQuery version and encoding for this module:

xquery version "3.0" encoding "utf-8";

Module Resources
  • the XQuery module can be found here.
Module Dependencies

Imported modules:

Related Documentation

For more details please also see:

Namespaces
excel-engineering http://www.zorba-xquery.com/modules/excel/engineering
excel-err http://www.zorba-xquery.com/modules/excel/errors
excel-math http://www.zorba-xquery.com/modules/excel/math
excel-text http://www.zorba-xquery.com/modules/excel/text
ver http://www.zorba-xquery.com/options/versioning
Function Summary
bin2dec ( $arg as xs:anyAtomicType ) as xs:integer
Converts a binary number to decimal.
bin2hex ( $arg as xs:anyAtomicType ) as xs:string
Converts a binary number to hexadecimal.
bin2hex ( $arg as xs:anyAtomicType, $places as xs:anyAtomicType ) as xs:string
Converts a binary number to hexadecimal.
bin2oct ( $arg as xs:anyAtomicType ) as xs:string
Converts a binary number to octal.
bin2oct ( $arg as xs:anyAtomicType, $places as xs:anyAtomicType ) as xs:string
Converts a binary number to octal.
dec2bin ( $arg as xs:anyAtomicType ) as xs:string
Converts a decimal number to binary.
dec2bin ( $arg as xs:anyAtomicType, $places as xs:anyAtomicType ) as xs:string
Converts a decimal number to binary.
dec2hex ( $arg as xs:anyAtomicType ) as xs:string
Converts a decimal number to hexadecimal.
dec2hex ( $arg as xs:anyAtomicType, $places as xs:anyAtomicType ) as xs:string
Converts a decimal number to hexadecimal.
dec2oct ( $arg as xs:anyAtomicType ) as xs:string
Converts a decimal number to octal.
dec2oct ( $arg as xs:anyAtomicType, $places as xs:anyAtomicType ) as xs:string
Converts a decimal number to octal.
hex2bin ( $arg as xs:anyAtomicType ) as xs:string
Converts a hexadecimal number to binary.
hex2bin ( $arg as xs:anyAtomicType, $places as xs:anyAtomicType ) as xs:string
Converts a hexadecimal number to binary.
hex2dec ( $arg as xs:string ) as xs:integer
Converts a hexadecimal number to decimal.
hex2oct ( $arg as xs:anyAtomicType ) as xs:string
Converts a hexadecimal number to octal.
hex2oct ( $arg as xs:anyAtomicType, $places as xs:anyAtomicType ) as xs:string
Converts a hexadecimal number to octal.
oct2bin ( $arg as xs:anyAtomicType ) as xs:string
Converts an octal number to binary.
oct2bin ( $arg as xs:anyAtomicType, $places as xs:anyAtomicType ) as xs:string
Converts an octal number to binary.
oct2dec ( $arg as xs:anyAtomicType ) as xs:integer
Converts an octal number to decimal.
oct2hex ( $arg as xs:anyAtomicType ) as xs:string
Converts an octal number to hexadecimal.
oct2hex ( $arg as xs:anyAtomicType, $places as xs:anyAtomicType ) as xs:string
Converts an octal number to hexadecimal.
Functions
bin2dec back to 'Function Summary'
declare function excel-engineering:bin2dec (
            $arg as xs:anyAtomicType 
 ) as xs:integer

Converts a binary number to decimal.

Parameters:
  • $arg the number.
Returns:
  • A decimal representation of a number given it's binary representation.
Errors:
  • excel-err:Value if provided value for $arg is not a binary representation of a number.
  • excel-err:Value if provided value for $arg contains more than 10 characters.
See:

bin2hex back to 'Function Summary'
declare function excel-engineering:bin2hex (
            $arg as xs:anyAtomicType 
 ) as xs:string

Converts a binary number to hexadecimal.

Parameters:
  • $arg the number.
Returns:
  • A hexadecimal representation of a number given it's binary representation.
Errors:
  • excel-err:Value if provided value for $arg is not a binary representation of a number.
  • excel-err:Value if provided value for $arg contains more than 10 characters.
See:

bin2hex back to 'Function Summary'
declare function excel-engineering:bin2hex (
            $arg as xs:anyAtomicType, 
            $places as xs:anyAtomicType 
 ) as xs:string

Converts a binary number to hexadecimal.

Parameters:
  • $arg the number.
  • $places is the number of characters to use. Places is useful for padding the return value with leading 0s (zeros).
Returns:
  • A hexadecimal representation of a number given it's binary representation.
Errors:
  • excel-err:Value if provided value for $arg is not a binary representation of a number.
  • excel-err:Value if provided value for $arg contains more than 10 characters.
  • excel-err:Value if provided value for $places is not numeric.
  • excel-err:Num if provided value for $places is zero or negative.
  • excel-err:Num if provided value for $places is too small.
See:

bin2oct back to 'Function Summary'
declare function excel-engineering:bin2oct (
            $arg as xs:anyAtomicType 
 ) as xs:string

Converts a binary number to octal.

Parameters:
  • $arg the number.
Returns:
  • A octal representation of a number given it's binary representation.
Errors:
  • excel-err:Value if provided value for $arg is not a binary representation of a number.
  • excel-err:Value if provided value for $arg contains more than 10 characters.
See:

bin2oct back to 'Function Summary'
declare function excel-engineering:bin2oct (
            $arg as xs:anyAtomicType, 
            $places as xs:anyAtomicType 
 ) as xs:string

Converts a binary number to octal.

Parameters:
  • $arg the number.
  • $places is the number of characters to use. Places is useful for padding the return value with leading 0s (zeros).
Returns:
  • A octal representation of a number given it's binary representation.
Errors:
  • excel-err:Value if provided value for $arg is not a binary representation of a number.
  • excel-err:Value if provided value for $arg contains more than 10 characters.
  • excel-err:Value if provided value for $places is not numeric.
  • excel-err:Num if provided value for $places is zero or negative.
  • excel-err:Num if provided value for $places is too small.
See:

dec2bin back to 'Function Summary'
declare function excel-engineering:dec2bin (
            $arg as xs:anyAtomicType 
 ) as xs:string

Converts a decimal number to binary.

Parameters:
  • $arg the number.
Returns:
  • A binary representation of a number given it's decimal representation.
Errors:
  • excel-err:Value if provided value for $arg is not numeric.
  • excel-err:Num if provided value for $arg is smaller than -512 or bigger than 511.
See:

dec2bin back to 'Function Summary'
declare function excel-engineering:dec2bin (
            $arg as xs:anyAtomicType, 
            $places as xs:anyAtomicType 
 ) as xs:string

Converts a decimal number to binary.

Parameters:
  • $arg the number.
  • $places is the number of characters to use. Places is useful for padding the return value with leading 0s (zeros).
Returns:
  • A binary representation of a number given it's decimal representation.
Errors:
  • excel-err:Value if provided value for $arg is not numeric.
  • excel-err:Value if provided value for $places is not numeric.
  • excel-err:Num if provided value for $places is zero or negative.
  • excel-err:Num if provided value for $places is too small.
  • excel-err:Num if provided value for $arg is smaller than -512 or bigger than 511.
See:

dec2hex back to 'Function Summary'
declare function excel-engineering:dec2hex (
            $arg as xs:anyAtomicType 
 ) as xs:string

Converts a decimal number to hexadecimal.

Parameters:
  • $arg the number.
Returns:
  • A hexadecimal representation of a number given it's decimal representation.
Errors:
  • excel-err:Value if provided value for $arg is not numeric.
  • excel-err:Num if provided value for $arg is smaller than -549755813888 or bigger than 549755813887
See:

dec2hex back to 'Function Summary'
declare function excel-engineering:dec2hex (
            $arg as xs:anyAtomicType, 
            $places as xs:anyAtomicType 
 ) as xs:string

Converts a decimal number to hexadecimal.

Parameters:
  • $arg the number.
  • $places is the number of characters to use. Places is useful for padding the return value with leading 0s (zeros).
Returns:
  • A hexadecimal representation of a number given it's decimal representation.
Errors:
  • excel-err:Value if provided value for $arg is not numeric.
  • excel-err:Value if provided value for $places is not numeric.
  • excel-err:Num if provided value for $places is zero or negative.
  • excel-err:Num if provided value for $places is too small.
  • excel-err:Num if provided value for $arg is smaller than -549755813888 or bigger than 549755813887.
See:

dec2oct back to 'Function Summary'
declare function excel-engineering:dec2oct (
            $arg as xs:anyAtomicType 
 ) as xs:string

Converts a decimal number to octal.

Parameters:
  • $arg the number.
Returns:
  • An octal representation of a number given it's decimal representation.
Errors:
  • excel-err:Value if provided value for $arg is not numeric.
  • excel-err:Num if provided value for $arg is smaller than -536870912 or bigger than 536870911.
See:

dec2oct back to 'Function Summary'
declare function excel-engineering:dec2oct (
            $arg as xs:anyAtomicType, 
            $places as xs:anyAtomicType 
 ) as xs:string

Converts a decimal number to octal.

Parameters:
  • $arg the number
  • $places is the number of characters to use. Places is useful for padding the return value with leading 0s (zeros).
Returns:
  • An octal representation of a number given it's decimal representation.
Errors:
  • excel-err:Value if provided value for $arg is not numeric
  • excel-err:Value if provided value for $places is not numeric
  • excel-err:Num if provided value for $places is zero or negative
  • excel-err:Num if provided value for $places is too small
  • excel-err:Num if provided value for $arg is smaller than -536870912 or bigger than 536870911
See:

hex2bin back to 'Function Summary'
declare function excel-engineering:hex2bin (
            $arg as xs:anyAtomicType 
 ) as xs:string

Converts a hexadecimal number to binary.

Parameters:
  • $arg the number.
Returns:
  • A binary representation of a number given it's hexadecimal representation.
Errors:
  • excel-err:Value if provided value for $arg is not a hexadecimal representation of a number.
  • excel-err:Value if provided value for $arg contains more than 10 characters.
See:

hex2bin back to 'Function Summary'
declare function excel-engineering:hex2bin (
            $arg as xs:anyAtomicType, 
            $places as xs:anyAtomicType 
 ) as xs:string

Converts a hexadecimal number to binary.

Parameters:
  • $arg the number.
  • $places is the number of characters to use. Places is useful for padding the return value with leading 0s (zeros).
Returns:
  • A binary representation of a number given it's hexadecimal representation.
Errors:
  • excel-err:Value if provided value for $arg is not a hexadecimal representation of a number.
  • excel-err:Value if provided value for $arg contains more than 10 characters.
  • excel-err:Value if provided value for $places is not numeric.
  • excel-err:Num if provided value for $places is zero or negative.
  • excel-err:Num if provided value for $places is too small.
See:

hex2dec back to 'Function Summary'
declare function excel-engineering:hex2dec (
            $arg as xs:string 
 ) as xs:integer

Converts a hexadecimal number to decimal.

Parameters:
  • $arg the number.
Returns:
  • A decimal representation of a number given it's hexadecimal representation.
Errors:
  • excel-err:Value if provided value for $arg is not a hexadecimal representation of a number.
  • excel-err:Value if provided value for $arg contains more than 10 characters.
See:

hex2oct back to 'Function Summary'
declare function excel-engineering:hex2oct (
            $arg as xs:anyAtomicType 
 ) as xs:string

Converts a hexadecimal number to octal.

Parameters:
  • $arg the number.
Returns:
  • A octal representation of a number given it's hexadecimal representation.
Errors:
  • excel-err:Value if provided value for $arg is not a hexadecimal representation of a number.
  • excel-err:Value if provided value for $arg contains more than 10 characters.
See:

hex2oct back to 'Function Summary'
declare function excel-engineering:hex2oct (
            $arg as xs:anyAtomicType, 
            $places as xs:anyAtomicType 
 ) as xs:string

Converts a hexadecimal number to octal.

Parameters:
  • $arg the number.
  • $places is the number of characters to use. Places is useful for padding the return value with leading 0s (zeros).
Returns:
  • A octal representation of a number given it's hexadecimal representation.
Errors:
  • excel-err:Value if provided value for $arg is not a hexadecimal representation of a number.
  • excel-err:Value if provided value for $arg contains more than 10 characters.
  • excel-err:Value if provided value for $places is not numeric.
  • excel-err:Num if provided value for $places is zero or negative.
  • excel-err:Num if provided value for $places is too small.
See:

oct2bin back to 'Function Summary'
declare function excel-engineering:oct2bin (
            $arg as xs:anyAtomicType 
 ) as xs:string

Converts an octal number to binary.

Parameters:
  • $arg the number.
Returns:
  • A binary representation of a number given it's octal representation.
Errors:
  • excel-err:Value if provided value for $arg is not an octal representation of a number.
  • excel-err:Value if provided value for $arg contains more than 10 characters.
See:

oct2bin back to 'Function Summary'
declare function excel-engineering:oct2bin (
            $arg as xs:anyAtomicType, 
            $places as xs:anyAtomicType 
 ) as xs:string

Converts an octal number to binary.

Parameters:
  • $arg the number.
  • $places is the number of characters to use. Places is useful for padding the return value with leading 0s (zeros).
Returns:
  • A binary representation of a number given it's octal representation.
Errors:
  • excel-err:Value if provided value for $arg is not an octal representation of a number.
  • excel-err:Value if provided value for $arg contains more than 10 characters.
  • excel-err:Value if provided value for $places is not numeric.
  • excel-err:Num if provided value for $places is zero or negative.
  • excel-err:Num if provided value for $places is too small.
See:

oct2dec back to 'Function Summary'
declare function excel-engineering:oct2dec (
            $arg as xs:anyAtomicType 
 ) as xs:integer

Converts an octal number to decimal.

Parameters:
  • $arg the number.
Returns:
  • A decimal representation of a number given it's octal representation.
Errors:
  • excel-err:Value if provided value for $arg is not an octal representation of a number.
  • excel-err:Value if provided value for $arg contains more than 10 characters.
See:

oct2hex back to 'Function Summary'
declare function excel-engineering:oct2hex (
            $arg as xs:anyAtomicType 
 ) as xs:string

Converts an octal number to hexadecimal.

Parameters:
  • $arg the number.
Returns:
  • A hexadecimal representation of a number given it's octal representation.
Errors:
  • excel-err:Value if provided value for $arg is not an octal representation of a number.
  • excel-err:Value if provided value for $arg contains more than 10 characters.
See:

oct2hex back to 'Function Summary'
declare function excel-engineering:oct2hex (
            $arg as xs:anyAtomicType, 
            $places as xs:anyAtomicType 
 ) as xs:string

Converts an octal number to hexadecimal.

Parameters:
  • $arg the number.
  • $places is the number of characters to use. Places is useful for padding the return value with leading 0s (zeros).
Returns:
  • A hexadecimal representation of a number given it's octal representation.
Errors:
  • excel-err:Value if provided value for $arg is not an octal representation of a number.
  • excel-err:Value if provided value for $arg contains more than 10 characters.
  • excel-err:Value if provided value for $places is not numeric.
  • excel-err:Num if provided value for $places is zero or negative.
  • excel-err:Num if provided value for $places is too small.
See:

blog comments powered by Disqus