🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
OCLOperators toDecimal
Created by Charles on 2024-09-21 · Last edited by Sandra.akech on 2025-12-12.

Converts the specified value to a decimal number.

OCL Result
123.ToDecimal 123
24235235235235.234234234234234.ToDecimal 24235235235235.2

Example Using with attributes:

myInt : Integer = 45

OCL:

myInt.toDecimal

Result:45 (as Decimal)

toDecimal converts any number (Integer or Float) into a Decimal

  • Useful for accurate calculations
  • Helps prevent mistakes from mixing number types
  • Rounds very long decimals to fit the decimal limits