Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
I need help using scientific notation with Visual FoxPro
Message
 
To
23/01/1997 14:31:01
David Wang
Sullivan Environmental Consulting, Inc.
Alexandria, Virginia, United States
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00018247
Message ID:
00018262
Views:
38
>Does Visual Foxpro support using scientific notation? I have a table with very small numbers (1.0e-9, or so), and entering them has been a pain because I had to enter 0.0000000001. And when I want to show the table, I would like it to be in scientific notation as well. This should be intuitive and obvious, but I don't know the answer. Right now, my table stores the fields as numeric.
>
>thanks.

I used this many moons ago in FoxPro 2.0. It may give U some ideas.
if !empty(m.rfd_inh_sci)
m.rfd_inh = val(m.rfd_inh_sci)
if m.rfd_inh >= 1000.0
wait window "Number Too Large - Please Re-Enter"
m.rfd_inh_sci = " "
show get m.rfd_inh_sci
_curobj = objnum(m.rfd_inh_sci)
return 0
endif
if m.rfd_inh <= 1e-16 and m.rfd_inh # 0
wait window "Number Too Small - Please Re-Enter"
m.rfd_inh_sci = " "
show get m.rfd_inh_sci
_curobj = objnum(m.rfd_inh_sci)
return 0
endif
if m.rfd_inh = 0
m.rfd_inh_sci = "0.000E+0"
else
expon = floor(log10(m.rfd_inh))
temp_num = m.rfd_inh/(10^expon)
if expon < 0
temp_str = alltrim(str(temp_num,5,3))+"E"+alltrim(str(expon,4))
else
temp_str = alltrim(str(temp_num,5,3))+"E+"+alltrim(str(expon,3))
endif
m.rfd_inh_sci = temp_str
endif
show get m.rfd_inh_sci
endif
return .T.

htwh - Steve
P.S.: I am interested in what markets your company goes after... drop me a line sometime.
Steve Medvid
Systems Analyst

Environmental Resource Management
Previous
Reply
Map
View

Click here to load this message in the networking platform