How to ceate and key in exponential format

Recommended Posts

I'm unclear what you mean.  You can type these numbers as constants exactly how you did.  You can format existing numbers in scientific notation using the format() function and the %e or %E specifier:

format("%E", 1.0878E-9)

would return a string:


%e does the exact same thing but puts a lower case e in response:


Link to comment
Share on other sites

Thank you for the reply

I want to create a "Variable Value Component" and be able to

set the value with the exponential notation as in eg


0r   9.871E+3

Any documents or examples for me??\


Link to comment
Share on other sites

Yes.. The Display can show in the correct format...

Q1: But using the 'Set To' action within the  "Variable Value Component" only allows input in the format of 0.0000015,  [But I want to enter data as 1.5E-6]

Q2: I want to truncate the display from 9.123456E-9  to show only 9.1234E-9..  Please advise...


TQ again


Link to comment
Share on other sites

Q1: the set to action does allow scientific format.  It just doesn't display the current value in scientific.  That you can get around by using the system.entryDialog() function and a quick sequence instead of the Set To Action.  The code would be similar to this (assuming "x" is your variable you are setting):

private in = system.EntryDialog("Enter new value:", NULL, NULL, format("%e",x))
if (!isempty(in))
   x = in

Q2: format() is basically a pass through to the old C function printf().  You can search for printf() on the web and see lots of examples of how it can be used.  In your case, you'd want: "%.4E", though I should add that it will round, so 9.123456E-9 will show up as 9.1235E-009, not 9.1234E-009

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.