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
 Unwanted '0's at end of numeric values

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 - 09/03/2001 : 04:17:37 AM
Hi,

My 'problem' has been to generate a worksheet of results from dose response studies all in decimal notation, limiting the number of digits to the right of the decimal point - this is a requirement for upolading onto our database.
Okay, I can set the number of decimal digits in the column properties and temporarily alter the threshold for conversion to scientific notation (eg to a very low value) but I still can't avoid showing unwanted zeros which the user would not want to see.

For example,
1.23e-2 set with 6 decimal digits to the right would show 0.012300 rather than 0.0123

The only solution I have found is to :
1. Temporarily set the threshold to eg 1e-20
2. Convert all numeric columns to text
3. As part of a MOCA dll, read the value as a string then pass it back as a 'double' format numeric value eg

DataSet.GetValue((MOINDEX)oldrow, lpbuffer1.GetBuffer(40));
lpbuffer1.ReleaseBuffer();
DataSet.SetValue((MOINDEX)newrow, LabTalkStr2double(lpbuffer1));

4. Reset to previous threshold for conversion to scientific notation.

NB For my purposes, it is okay to generate an all text results worksheet - this also enables removing the missing value symbols '--' (quickly) as part of the same dll.

My questions are - am I missing something? and can I also avoid unwanted zeroes if I keep the column in numeric format?

Cheers,

Pete (Cook)
2   L A T E S T    R E P L I E S    (Newest First)
peter.cook Posted - 09/05/2001 : 08:25:35 AM
Mike,

Thanks for response.

Yes, default decimal digits would round off some values.
I have to set a very low threshold for conversion to scientific format to ensure decimal notation.

Setting the number of decimal digits could still result in unwanted zeros :

0.00000000123456789 would be OK
but
0.0000000012 would display as
0.00000000120000

setting to default decimal digits would result in round off
0.00000000123456789 would display as 0 but is read as 1.234568E-9.

Setting to eg 6 significant figures then displays 1.23457E-9 despite the 'conversion to scientific format' settings.

The above doesn't seem right and I guess it would be nice if Origin didn't show unwanted zeros, this should be so at least when significant figures are set.

Cheers,

Pete

Mike Posted - 09/04/2001 : 3:26:30 PM
Peter,

Could you simply call a second worksheet template with the Numeric Display set to "Default Decimal Digits" (which does not display trailing 0s) for each column, then use copy -x to copy your data to this template?

But I would guess that the problem is that the number of trailing 0s varies, and therefore specifying display of "default decimal digits" would round some values off, correct?

So -- What about setting the Lower Threshold Power to -14 (Tools: Options: Numeric Format)and then setting Number of Decimal Digits (same tab of Options) to a number sufficiently large to prevent rounding?

aplologies for the "stream of conciousness" response.

Mike

Edited by - mike on 09/04/2001 15:28:03

Edited by - mike on 09/04/2001 15:32:45

Edited by - mike on 09/04/2001 15:49:25

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