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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Unwanted '0's at end of numeric values
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

peter.cook

UK
356 Posts

Posted - 09/03/2001 :  04:17:37 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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)

Mike

USA
357 Posts

Posted - 09/04/2001 :  3:26:30 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

peter.cook

UK
356 Posts

Posted - 09/05/2001 :  08:25:35 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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

Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000