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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scientic notation

Status
Not open for further replies.

LindaRichard

Programmer
Feb 23, 2001
103
0
0
CA
Hi,

I am trying to display the number 0.00000009 using
scientific notation. I set the .format property of
a text box at ^ and it displays 9.0000E-8. I would
like to control the precision of the number displayed.
For example I want to display 9.0E-8. I tried setting
.format to 9.9^ and #.#^ but this had no effect.

Any suggestions are appreciated.

Thanks
Linda
 
Short of parsing out the unwanted zeros, I don't think there is another option in VFP.

While STR() will give Scientific Notation for large numbers, it doesn't work for small ones.
Code:
? STR(1234567890123,7) &&  1.E+12
? STR(1234567890123,8) &&  1.2E+12
? STR(1234567890123,9) &&  1.23E+12
Rick



 
Linda,

I don't think you can do that. By definition, scientific notation displays whatever precision the number is expressed in. The only way to get rid of those extra zeroes would be to parse them out, as Rick suggested.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Thank you both for taking the time
to answer my question.

I will do as you suggested and parse them out.

Thanks again

Linda

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top