Interbase – How to manually round calculate 3rd decimal [SOLVED]

I have seen a few computations done in interbase and a lot of them have trailing decimals after them and if we want to round them manually, this is what I have come up with.

Suggestions and alternative solutions are always welcome. I am using a few variables so I can see the results of the computation as they unravel.

/* 889.125 */
VINT1 = (PANNUAL_TAX * 100);
VAMT1 = (VINT1 / 100);

VINT2 = (PANNUAL_TAX - VAMT1) * 1000;
VAMT2 = VINT2;

IF (VAMT2 >= 50) THEN
     VAMT3 = VAMT1 + 0.01;
ELSE VAMT3 = VAMT1;

PANNUAL_TAX = VAMT3;

The PANNUAL_TAX is the variable that holds the 2 decimal result.

Enjoy,

Coffee Cup

Delphi: Check Internet Connection [SOLVED]

Recently a lot of apps right now are becoming internet dependent. Currently the project I am working on requires the system to know if there is internet or not.

Here is the code snippet I found

uses WinInet;
 
var
  origin: cardinal;
begin
  if InternetGetConnectedState(@origin,0) then
    ShowMessage('Connected!')
  else
    ShowMessage('Not connected')
  end;
end;

Enjoy

Coffee Cup

 16 total views,  1 views today