# Decimal Floating-Point Math Library newbie question

## Decimal Floating-Point Math Library newbie question

Hi all:

I'm trying use/understand the Decimal Floating-Point Library. After

compiling with success the libraries, the tests and the examples, as a

first attempt I try a light addition to the example in the file

main.c_011:

First, adding a new set of variables:

Decimal128 a, b, c;

After the sentence:

printf ("TEST CASE 1 FOR __bid128_mul 011 () PASSED
");

I initiate the new variables (as in the example) and try an addition:

a.w[HIGH_128W] = 0x3040000000000000ull; a.w[LOW_128W] =

0x0000000000000002ull; // a = 2

b.w[HIGH_128W] = 0x3040000000000000ull; b.w[LOW_128W] =

0x0000000000000003ull; // b = 3

In this last sentence, I obtain an C2440 error:

error: cannot convert from 'int' to 'Decimal128'

I'm using the MS Visual Studio 2008 compiler Standard Edition under

Windows XP.

Any help or suggestion wold be much appreciated.

4 posts / 0 new
For more complete information about compiler optimizations, see our Optimization Notice.

Hi,

I think all you need is a line in decimal.h, with:

If you want to be able toprint the result, add also:

extern __bid128_to_string (char *, Decimal128);

Decimal128 a, b, c;
char str[128];

__bid128_to_string (str, c);
printf ("c = %s
", str);

So you need to list (in decimal.h or main.c) all the library functions you are using. A complete list is in LIBRARY/bid_functions.h, but some editing will be necessary if you wish to include all.

Thanks -

That works, but the result is: c = +5E+0

How can I get a decimal (not scientific/engineering) format?