Section Header
  
  
    + name := NUMERIC;
  
  
    - comment     :="Generic number.";
  
Section Inherit
  
  
    - parent_object:OBJECT := 
    
Section Public
  
  
 Features
  
  
  
    - one:SELF  <-  
         Neutral element for `*' and `/'.
  
  
    - zero:SELF <-  
         Neutral element for `+' and `-'.
  
  
 Functions
  
 
  
  
    - in_range low:SELF to up:SELF :BOOLEAN <- 
  
    
  
    - sign:INTEGER <-
  
         Sign of Current (0 -1 or 1).
  
  
  
 binary operator :
  
  
  
    - '-'  Left 80  other:SELF :SELF <- 
  
  
    - '*'  Left 100 other:SELF :SELF <- 
  
  
    - '/'  Left 100 other:SELF :SELF <-  
         ? {other/=0}
    
  
    - '+'  Left 80  other:SELF :SELF <- 
  
  
  
 Unary operator
  
  
  
    - '+' :SELF <- 
  
  
    - '-' :SELF <- 
  
  
 Compatibility Binary operator
  
  
  
    - '-#'  Left 80  other:INTEGER :SELF    <- 
  
  
    - '*#'  Left 100 other:INTEGER :SELF    <- 
  
  
    - '/#'  Left 100 other:INTEGER :SELF    <- 
    
  
    - '+#'  Left 80  other:INTEGER :SELF    <- 
  
  
    - '>#'  Right 60 other:INTEGER :BOOLEAN <- 
  
  
    - '<#'  Right 60 other:INTEGER :BOOLEAN <- 
  
  
    - '<=#' Right 60 other:INTEGER :BOOLEAN <- 
  
  
    - '>=#' Right 60 other:INTEGER :BOOLEAN <- 
  
  
 Test binary operator :
  
  
  
    - '=='  Right 60 other:SELF :BOOLEAN <- 
  
  
    - '!==' Right 60 other:SELF :BOOLEAN <- 
  
  
    - '>'   Right 60 other:SELF :BOOLEAN <- 
  
  
    - '<'   Right 60 other:SELF :BOOLEAN <- 
  
  
    - '<='  Right 60 other:SELF :BOOLEAN <- 
  
  
    - '>='  Right 60 other:SELF :BOOLEAN <- 
  
  
  
 Switch case :
  
  
  
    - when value:SELF then block:BLOCK :SELF <-
    
  
    - when value1:SELF or value2:SELF then block:BLOCK :SELF <-
    
  
    - when first_value:SELF to last_value:SELF then block:BLOCK :SELF <-
    
  
  
 Looping.
  
  
  
    - to limit_up:SELF do blc:BLOCK <-
    
  
    - downto limit_down:SELF do blc:BLOCK <-
    
  
    - to limit_up:SELF by step:SELF do blc:BLOCK <-
    
  
    - downto limit_down:SELF by step:SELF do blc:BLOCK <-
    
  
  
 Function :
  
  
  
    - abs:SELF <- 
  
         Absolute value of `self'.
    
  
    - min other:SELF :SELF <-
    
  
    - max other:SELF :SELF <-
    
  
  
 Conversion for other type.
  
  
  
    - to_string:STRING <-
  
         Convert the decimal view of `self' into a new allocated STRING.
  
         For example, if `self' is -1 the new STRING is -1.
  
         Note: see also `append_in' to save memory.
    
  
    - to_boolean:BOOLEAN <- 
  
  
    - append_in buffer:STRING <- 
  
         Append in the `buffer' the equivalent of `to_string'. No new STRING
  
         creation during the process.
  
  
    - to_string_format s:SELF :STRING <- 
  
         Same as `to_string' but the result is on `s' character and the
  
         number is right aligned.
  
         Note: see `append_in_format' to save memory.
    
  
    - append_in str:STRING format s:INTEGER <-
  
         Append the equivalent of `to_string_format' at the end of
  
         `str'. Thus you can save memory because no other
  
         STRING is allocate for the job.
  
  
    - append_in str:STRING format s:INTEGER with char:CHARACTER <-
  
         Append the equivalent of `to_string_format' at the end of
  
         `str'. Thus you can save memory because no other
  
         STRING is allocate for the job.
    
  
  
 Print
  
  
  
    - print <-
    
  
    - print_format s:SELF <-
      
  
    - print_format s:SELF with c:CHARACTER <-
      
  
  
 Conversions with tests
  
  
  
    - bound_test low:INTEGER_64 to up:UINTEGER_64 :BOOLEAN <-
      
  
  
 - To unsigned integers
  
  
    - to_uinteger_8:UINTEGER_8     <- 
  
  
    - to_uinteger_16:UINTEGER_16   <- 
  
  
    - to_uinteger_32:UINTEGER_32   <-
  
  
    - to_uinteger_64:UINTEGER_64   <- 
  
  
    - to_uinteger_big:UINTEGER_BIG <- 
    
  
  
 - To signed integers
  
  
  
    - to_integer:INTEGER <-   
  
  
    - to_integer_8:INTEGER_8   <-
  
  
    - to_integer_16:INTEGER_16 <-
  
  
    - to_integer_32:INTEGER_32 <-
  
  
    - to_integer_64:INTEGER_64 <-
  
        [ -? {bound_test (INTEGER_64.minimum) to (INTEGER_64.maximum)}; ]
  
  
    - to_integer_big:UINTEGER_BIG <- 
    
  
  
 - To unsigned fixed reals
  
  
    - to_ureal_16_16:UREAL_16_16 <-
  
  
    - to_ureal_24_8:UREAL_24_8   <-
  
  
    - to_ureal_26_6:UREAL_26_6   <-
    
  
  
 - To signed fixed reals
  
  
  
    - to_real_16_16:REAL_16_16 <-
  
  
    - to_real_24_8:REAL_24_8   <-
  
  
    - to_real_26_6:REAL_26_6 <-
    
  
  
 - To float reals
  
  
  
    - to_real:REAL <- 
  
  
    - to_real_32:REAL_32 <-
  
  
    - to_real_64:REAL_64 <-
  
  
    - to_real_80:REAL_80 <-
    
Section Public
  
  
  
 Convertion format without test.
  
  
  
    - to_raw_integer:INTEGER         <- 
  
    - to_raw_uinteger_8:UINTEGER_8   <- 
  
    - to_raw_uinteger_16:UINTEGER_16 <- 
  
    - to_raw_uinteger_32:UINTEGER_32 <- 
  
    - to_raw_uinteger_64:UINTEGER_64 <- 
  
  
    - to_raw_integer_8:INTEGER_8     <- 
  
    - to_raw_integer_16:INTEGER_16   <- 
  
    - to_raw_integer_32:INTEGER_32   <- 
  
    - to_raw_integer_64:INTEGER_64   <- 
  
  
    - to_raw_real:REAL               <- 
  
  
    - to_raw_ureal_16_16:UREAL_16_16 <- 
  
    - to_raw_ureal_24_8:UREAL_24_8   <- 
  
    - to_raw_ureal_26_6:UREAL_26_6   <-  
  
    - to_raw_real_16_16:REAL_16_16   <- 
  
    - to_raw_real_24_8:REAL_24_8     <- 
  
    - to_raw_real_26_6:REAL_26_6     <-  
  
    - to_raw_real_32:REAL_32         <- 
    
  
    - to_raw_real_64:REAL_64         <- 
  
    - to_raw_real_80:REAL_80         <-