Skip to content

Commit

Permalink
GC version of vdmSum.
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Bandur committed Nov 4, 2016
1 parent b2e9ec9 commit db1e783
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 0 additions & 2 deletions c/vdmclib/src/main/IOLib.c
Expand Up @@ -173,8 +173,6 @@ TVP vdm_IO_fecho(TVP filename, TVP text, TVP fdir)
}
TVP vdm_IO_echo(TVP text)
{
int a;

//TODO: Ensure a string is passed.
char *str = unpackString(text);

Expand Down
11 changes: 11 additions & 0 deletions c/vdmclib/src/main/VdmBasicTypes.c
Expand Up @@ -256,6 +256,17 @@ TVP vdmSum(TVP a,TVP b)
return newReal(av+bv);
}

TVP vdmSumGC(TVP a,TVP b, TVP *from)
{
ASSERT_CHECK_NUMERIC(a);
ASSERT_CHECK_NUMERIC(b);

double av = toDouble(a);
double bv=toDouble(b);

return newRealGC(av+bv, from);
}

TVP vdmDifference(TVP a,TVP b)
{
ASSERT_CHECK_NUMERIC(a);
Expand Down
1 change: 1 addition & 0 deletions c/vdmclib/src/main/VdmBasicTypes.h
Expand Up @@ -52,6 +52,7 @@ TVP vdmMinus(TVP arg);
TVP vdmAbs(TVP arg);
TVP vdmFloor(TVP arg);
TVP vdmSum(TVP a,TVP b);
TVP vdmSumGC(TVP a,TVP b, TVP *from);
TVP vdmDifference(TVP a,TVP b);
TVP vdmProduct(TVP a,TVP b);
TVP vdmDivision(TVP a,TVP b);
Expand Down

0 comments on commit db1e783

Please sign in to comment.