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

Return type: Integer
Returns:       

The product of its operands.



Syntax
  numeric-expression * numeric-expression


Purpose

You can multiply two numeric values together using the * operator.

To multiply BCD numbers, you must include the ombcd.xin file in your program. To multiply floating point numbers, include the omfloat.xin file.

You can multiply 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.

Always surround arithmetic operators with spaces.

BCD Example:

  ; Distance = speed * time
    include "ombcd.xin"
    process
        local bcd kilometers-per-hour initial {90}
        local bcd hours initial {1.5}
        local bcd distance
        set distance to kilometers-per-hour * hours
        output "Distance is "
            || "d" % distance
            || " kilometers.%n"
  ; Output: 'Distance is 135 kilometers'.

Floating Point Example:

  ; E = IR (volts = amperes * ohms)
    include "omfloat.xin"
    process
        local float amperes initial {1.9237}
        local float ohms initial {60}
        local float volts
        set volts to amperes * ohms
        output "Volts = "
            || "d" % volts
            || "%n"
  ; Output: 'Volts = 115.422'

Mixed Data Type Example:

  include "ombcd.xin"
  process
      local integer apples-per-child initial {6}
      local integer school-children initial {28}
      local integer total-apples

      local bcd apple-price
      local bcd tax-rate
      local bcd total-price

      set total-apples to apples-per-child * school-children
      output "Total apples = "
                  || "d" % total-apples
                  || "%n"

      set apple-price to bcd 0.33
      set tax-rate to bcd 0.05
      set total-price to total-apples * apple-price * (1 + tax-rate)
      output "Total price = "
                  || "<$,NNZ.ZZ>" % total-price
                  || "%n"
  ; Output: 'Total apples = 168'
  ;          'Total price = $58.21'

The word times is a deprecated synonym for *.

For floating point numbers, overflow and underflow values return infinity and zero, respectively.

BCD numbers cannot overflow, but returns 0 on underflow.

Integers cannot underflow, but overflow returns an incorrect answer depending on the operating system.

    Related Syntax
   /
 
Related Concepts
   int32 data type
 
----  

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

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

Copyright © OmniMark Technologies Corporation, 1988-2000.