THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 26/02/2004 at 04:05, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 8.2
Platform:
Language(s) : C++ ;
---------
Hi
I'm trying to determine a percentage value by using the following code
LONG a = 10;
LONG b = 50;
Real rperc = a/b*100;
LONG lperc = a/b*100;
float fa = 10;
float fb = 50;
float fperc = fa/fb*100;
GePrint("Real: " + RealToString(rperc));
GePrint("Long: " + LongToString(lperc));
GePrint("Float: " + RealToString(fperc));
Real always returns 0
Long always returns 0
float returns the correct answer of 20
So whats the difference between Real and float? Is it ok to use float instead of Real?
I don't know anything about a Mac, but Iv'e always assumed Real was there to use so everything is platform independant, because I thought a float wasn't?
This has confused me, because I realy need to return a percentage of a number and use it for StatusSetBar(), but how can I do this if LONG and Real datatypes don't return the correct results