Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying large numbers in v. foxpro

Status
Not open for further replies.

EzLogic

Programmer
Aug 21, 2001
1,230
US
vfp 7.0 sp1
win xp pro

i have a function that converts from hex to dec.

if i put it in the windows calculator, i get the following:

my hex number: 51011623232
windows calc : 5566569263666
vfp solution : 5.566E+12 <- i don't want scientific notation.

if the number happened to be smaller, then i get the right solution..

any suggestions?

i tried using the str() but, no luck.


Ali Koumaiha
Wireless Toyz
Farmington Hills, Michigan
 

Would this be of any help? thread184-1043838
As for displaying only, I guess it depends on the space available. Where are you displaying it?

 
Thanks for the reply, i don't think that helped me...

i am just doing it in the vfp command window..

?h2d('somenumber') and i get the result in scientific notation.

however if the number is smaller, i don't get the scientific notation.



Ali Koumaiha
Wireless Toyz
Farmington Hills, Michigan
 
I used Transform() instead of str() and i got it to work..

thanks


Ali Koumaiha
Wireless Toyz
Farmington Hills, Michigan
 

TRANSFORM() is good, but even if you use STR() with the right number of symbols specified (say, STR(MyNumber,16), not just the default 10), it will work, too.
 
Stella740pl is right...

However, str(number,16) will not display decimals if there are any. It displays integers only (positive and negative whole numbers)

?str(-12345678.8765,16) displays -12345679

It rounds also, and curiously. It rounds the absolute value!

Tony
 
Just make sure your whole decimal number is no larger or smaller than absolute 6,755,399,441,055,748. That's the maximum VFP 9 can handle with STR(). If you need decimals, the number must be much smaller, somewhere about 15 digits maximum, excluding commas and decimal points. Somewhere in the 16 digits range precision gets lost. As I recall precision is desplayed out to about 15 digits and comparisons go out to about 18 digits, mainly so we don't see numbers that look identical but compare as different.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top