Table of Content
HAL Forum
function roundmode SetRoundMode (
integer decimals,integer direction,integer mode,integer step)
Description:
Returns roundmode variable that has been populated wiht specified settings
Parameters:
decimals Number of decimals
direction The direction for the rounding
mode Rounding mode
step Decimals step on rounding.
// Direction: kRoundingDirectionToFromPosInf ,kRoundingDirectionToFromZero
// Modes: kRoundingModeTruncate, kRoundingModeHalfUp,kRoundingModeHalfDown, kRoundingModeToEven, kRoundingModeToOdd
// Step: kRoundingStepNone,kRoundingStep5, kRoundingStep25

external function roundmode SetRoundMode(Integer,Integer,Integer,Integer);

global
procedure OnApplicationStartup() 
begin
  record IVVc IVr;
  roundmode rmde;

  rmde = SetRoundMode(1,kRoundingDirectionToFromPosInf,kRoundingModeHalfUp,kRoundingStep5);
  stopalert(Round(1.43,rmde)); // returns 1,50
  rmde = SetRoundMode(1,kRoundingDirectionToFromPosInf,kRoundingModeHalfUp,kRoundingStepNone);
  stopalert(Round(1.43,rmde)); // returns 1,40

  return;
end;
Related topics:
««