The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Numeric variable format problem

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
peter.cook Posted - 11/07/2003 : 05:43:35 AM
Hi,

recently noticed that there is an inconsistency in the (format of) values returned from nyumeric variables.

Examples :

pete=n; n= 


pete=0.001 returns pete=1e-3
pete=0.00101 returns pete=0.00101
pete=0.002 returns pete =0.002
pete=0.00201 returns pete=0.00201
pete=0.0002 returns pete=2e-4

This is a problem as I would like to run code like the following :

[u]loop(numcol,1,%H!wks.ncols) {
loop(numrow,1,numrows) {
%T=%(%H,numcol,numrow);
%(NewSheet,numcol,numrow)=%T;
};
};

for simplicity.

The issue is copying from and to mixed format worksheets ('numeric and text' and 'text' data).
Any help appreciated.

Cheers,

Pete

1   L A T E S T    R E P L I E S    (Newest First)
greg Posted - 11/07/2003 : 10:20:24 AM
There are two parts here:
Your first examples only demonstrate that Origin has options to auto-display values above or below specified magnitudes in standard or scientific notation. In the examples, all numbers less than or equal to .001 display in scientific notation - which means you are using the default Tools : Options : [Numeric Format] : "Lower Threshold Power" of -3. In all your cases, the real values and the displayed values are mathematically equivalent. There could be a case where the real value differs mathematically from the displayed value. For example, enter 0.999999999 into a cell and (by the defaults controlling the display format) you will see 1 : an 'error' of .000000001.

There can, therefore be a problem if you put the display form of numeric data into a text column : you will lose some precision.

I think an older version of Origin used to exhibit this problem when using %(worksheet,column,row) notation, but it was fixed, and - in addition - we added the cell(row,column) notation which can do text or numeric.

So you should be aware of differences in script handling of data formats, and you should code to handle those differences. In a worst case scenario - mixed text and numbers - you might have to do some creative programming, such as:

loop(numrow,1,numrows) {
%T=%(%H,numcol,numrow);
if($(%T)==0/0) NewSheet!cell(numrow,numcol)$= %T;
else NewSheet!cell(numrow,numcol)=%T;
};

Note that the %(worksheet,column,row) notation does not allow for string assignment, so I used the worksheet!cell() function which can do either text or numeric. Also - a warning - I've forgotten which service release of which version introduced the cell() function, but it was initially defined as cell(numcol,numrow).


The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000