NTNUJAVA Virtual Physics LaboratoryEnjoy the fun of physics with simulations! Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/
August 23, 2019, 07:33:32 am

Progress is impossible without change; and those who cannot change their minds cannot change anything. ..."George Bernard Shaw(1865-1950, Irish dramatist, essayist and critic, Nobel Prize for Literature 1925)"

 Pages: [1]   Go Down
 Author Topic: this is how to make display show in scientific format 0.00E00 like tracker  (Read 5264 times) 0 Members and 1 Guest are viewing this topic. Click to toggle author information(expand message area).
lookang
Hero Member

Offline

Posts: 1792

http://weelookang.blogspot.com

 « Embed this message on: August 10, 2010, 09:10:53 am » posted from:SINGAPORE,SINGAPORE,SINGAPORE

Format
The format used to display the value, i.e. the number of decimal digits with which to display the value.   Type 0.0 with one or more zeros after the point.

http://www.um.es/fem/EjsWiki/Main/ElementsSlider

i just try 0.00E00 and it works!
cool man

 Logged
lookang
Hero Member

Offline

Posts: 1792

http://weelookang.blogspot.com

 « Embed this message Reply #1 on: August 10, 2010, 09:13:19 pm » posted from:Singapore,,Singapore

Dear Ejs learning community

I have a question.

I have a custom function
double dv;
public String double2String(double v,double divider){
if(v > 0)dv=0.5;
else if(v < 0)dv=-0.5;
else dv=0;
return (int)(v*divider+dv)/divider+"";
}

the string called cannot display the values correctly
for example
s_E2 = " {g_net} = 6.67*10^{ - 11} *( " +double2String(m1,10.)+")"+"/("+double2String(x1-xtest,10.)+"){^2}" ;

how can the codes be modified to display in scientific form?

this doesn't work
s_E2 = " {g_net} = 6.67*10^{ - 11} *( " +double2String(m1,0.00E00)+")"+"/("+double2String(x1-xtest,0.00E00)+"){^2}" ;

any tips?

i think must rewrite the custom function but i don't know how to start
or is there some open source physics function that can do this?
 errorwith00e00.png (2.12 KB, 266x81 - viewed 418 times.) *** There are 1 more attached files. You need to login to acces it! « Last Edit: August 10, 2010, 09:15:26 pm by lookang » Logged
lookang
Hero Member

Offline

Posts: 1792

http://weelookang.blogspot.com

 « Embed this message Reply #2 on: August 11, 2010, 08:05:48 am » posted from:SINGAPORE,SINGAPORE,SINGAPORE

http://www.um.es/fem/EjsWiki/Main/ElementsSlider

edited the wiki to include

Format
The format used to display the value, i.e. the number of decimal digits with which to display the value.
Type 0.0 with one or more zeros after the point. or 0.00E00 for scientific notation
 Logged
 Pages: [1]   Go Up
Progress is impossible without change; and those who cannot change their minds cannot change anything. ..."George Bernard Shaw(1865-1950, Irish dramatist, essayist and critic, Nobel Prize for Literature 1925)"