swirl Guide to OmniMark 5   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesOMX VariablesErrors
 
    Related Concepts  
operator   modulo    

Return type: Integer
Returns:       

The remainder.



Syntax
  numeric-expression modulo numeric-expression


Purpose

Use modulo to find the modulus of a number with respect to a base value. The modulus is the remainder from dividing the number by the base value.

To use BCD numbers in a modulo operation, you must include the ombcd.xin file in your program. To use floating point numbers, include the omfloat.xin file.

You can use values of mixed data types (for example, BCD numbers and integers) as long as you follow the rules listed in Operations with mixed data types.

Integer example:

  process
     local integer seconds initial {3700}
     local integer minutes
     local integer hours
     local integer days

     set minutes to seconds / 60
     set seconds to seconds modulo 60
     set hours to minutes / 60
     set minutes to minutes modulo 60
     set days to hours / 24
     set hours to minutes modulo 24
     output "Days: "
         || "d" % days
         || "; Hours: "
         || "d" % hours
         || "; Minutes: "
         || "d" % minutes
         || "; Seconds: "
         || "d" % seconds
         || "%n"
  ; Output: "Days: 0; Hours: 1; Minutes: 1; Seconds: 40"

Mixed data type example:

  include "ombcd.xin"
  process
     local bcd seconds initial {3700}
     local bcd minutes
     local bcd hours
     local bcd days

     set minutes to truncate (seconds / 60)
     set seconds to seconds modulo 60
     set hours to truncate (minutes / 60)
     set minutes to minutes modulo 60
     set days to truncate (hours / 24)
     set hours to minutes modulo 24
     output "Days: "
         || "d" % days
         || "; Hours: "
         || "d" % hours
         || "; Minutes: "
         || "d" % minutes
         || "; Seconds: "
         || "d" % seconds
         || "%n"
  ; Output: "Days: 0; Hours: 1; Minutes: 1; Seconds: 40"

      Related Concepts
   int32 data type
 
----  

Top [ INDEX ] [ CONCEPTS ] [ TASKS ] [ SYNTAX ] [ LIBRARIES ] [ OMX ] [ OMX ] [ ERRORS ]

Generated: August 11, 2000 at 3:07:33 pm
If you have any comments about this section of the documentation, send email to docerrors@omnimark.com

Copyright © OmniMark Technologies Corporation, 1988-2000.