Home  |  Delphi .net Home  |  System.Decimal  |  Remainder Method
Remainder  
Method  
Divides one Decimal value by another and returns the remainder
Decimal Structure
System NameSpace
CF1.  Function Remainder ( ValueA:DecimalValueA : Decimal; ValueB : Decimal; ) : Decimal; Static;
CF : Methods with this mark are Compact Framework Compatible
Description
Divides ValueA by ValueB and returns the remainder from this division.
 
An exception is thrown if the divide fails.
Notes
Static methods are not methods of an object - they are simply class functions or procedures available at any time.
Microsoft MSDN Links
System
System.Decimal
 
 
A simple example
program Project1;
{$APPTYPE CONSOLE}

var
  valueA, valueB : Decimal;
  result         : Decimal;
  rem            : Decimal;

begin
  valueA := 16.8;
  valueB := 4;

  result := System.Decimal.Divide(valueA, valueB);
  rem    := System.Decimal.Remainder(valueA, valueB);

  Console.WriteLine('valueA                   = {0}', valueA.ToString);
  Console.WriteLine('valueB                   = {0}', valueB.ToString);
  Console.WriteLine('valueA divided by valueB = {0}', result.ToString);
  Console.WriteLine('               remainder = {0}', rem.ToString);

  Console.ReadLine;
end.
Show full unit code
  valueA                   = 16.8
  valueB                   = 4
  valueA divided by valueB = 4.2
                 remainder = 0.8
 
 
Delphi Programming © Neil Moffatt All rights reserved.  |  Contact the author