LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

question on extended precision variables in CVI

Two dumb questions

1) how do you declare 64 bit integer in CVI ? (long long in ANSI C)
2) how do you declare extended precision float and how many bits is this in CVI?  i tried long double, but that seems to be the same as double and the compiler doe not recognize "extended"

Using CVI 7.x



0 Kudos
Message 1 of 5
(3,597 Views)

Under CVI 7.1

__int64 is the 64 bit integer data type.

long double is a valid type but is a 64 bit real with the same range as a conventional double.  I do not know of a data type longer than 64 bits.

0 Kudos
Message 2 of 5
(3,590 Views)
You can also declare it as a LONGLONG if you include windows.h

You should also know that the native CVI compiler has a bug in it with __int64.

If a __int64 of static storage class is used on the right hand side of a binary operator in an expression, at execution time you get a general protection fault and your application crashes.

This may have been fixed in CVI 8.1 or 8.1.1

Menchar
0 Kudos
Message 3 of 5
(3,582 Views)
To follow up -

There's no floating point representation in CVI greater than 64 bits.  See IEEE 754 in the wikipedia:     http://en.wikipedia.org/wiki/IEEE_754

for info on the fp formats.  On an Intel math co, internally double precision is handled as 80 bits, so you get 16 "guard bits" during computations that helps preserve precision.

There are several arbitrary precision floating point packages available - you can get as much precision as you want and can afford.   Java has the "big decimal" class for this - and most math packages have it - Maple does I know.

Wiki says "BigDigits" is a c library for arbitrary-precision arithmetic, also MAPM, MPFR, CLN, decNumber, etc.

http://en.wikipedia.org/wiki/Bignum

Menchar




0 Kudos
Message 4 of 5
(3,579 Views)
Thanks to all...silly me..  i forgot about the windows SDK data types since i generally prefer to use native CVI functions/code 😉
0 Kudos
Message 5 of 5
(3,552 Views)