anchor.diff:  get_numeric_type(TypeA, TypeA) -> TypeA;
   get_numeric_type('xs:double', _) -> 'xs:double';
   get_numeric_type(_,'xs:double') -> 'xs:double';
  +get_numeric_type('xs:float', _) -> 'xs:float';
  +get_numeric_type(_,'xs:float') -> 'xs:float';
  +get_numeric_type('xs:decimal', _) -> 'xs:decimal';
  +get_numeric_type(_,'xs:decimal') -> 'xs:decimal';
  +get_numeric_type('xs:integer', _) -> 'xs:integer';
  +get_numeric_type(_,'xs:integer') -> 'xs:integer';
   get_numeric_type(TypeA, TypeB) -> 
      N1 = num(TypeA),
      N2 = num(TypeB),
  
positive.code:             end, List1),
     ?bool(Bool).
  
  general_compare_any_1([#xqAtomicValue{} = V1|R1], Op, V2) ->
     case value_compare(Op,V1,V2) of
        ?bool(true) ->
           true;
  
negative.code:    atomize_list([Seq]);
  atomize_list([]) -> [].
  
  numeric_type_val(I) when is_integer(I) ->
     {'xs:integer', I};
  numeric_type_val(I) when is_float(I) ->
     {'xs:double', I};
  numeric_type_val(#xqAtomicValue{type = TypeA0, value = neg_zero}) 
     when ?xs_numeric(TypeA0) ->
     {TypeA0, 0.0};
  numeric_type_val(#xqAtomicValue{type = TypeA0, value = ValA0}) 
     when ?xs_numeric(TypeA0) ->
     {TypeA0, ValA0};
  numeric_type_val(neg_zero) ->
     {'xs:double', 0.0};
  numeric_type_val(At) when At == nan;
                            At == neg_infinity;
                            At == infinity ->
     {'xs:double', At};
  numeric_type_val(_) ->
     ?err('XPTY0004').
  
  
  % returns: numeric
  numeric_add(A, B) -> 
     {TypeA, ValA} = numeric_type_val(A),
     {TypeB, ValB} = numeric_type_val(B),
     TypeC = if TypeA =:= TypeB -> TypeA;
                true ->
                   get_numeric_type(TypeA, TypeB)
  