The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
May 5th, 2024, 7:44am
Pages: 1
Send Topic Print
How to increase Accuracy of Ocean output (Read 989 times)
AmiyaB
New Member
*
Offline



Posts: 8
Kolkata
How to increase Accuracy of Ocean output
Feb 16th, 2010, 8:00am
 
Hi,
In Ocean, Sub-version : 5.10.41_USR4.54.77, I am getting the result (or answer) upto 6 decimal places, like 1.483738e-07, accurate upto 10^-12.

I want to get the result in a accuracy upto 10^-15.

Hence, how can I set the precision of ocean output to 1femto or 10^-15.
Back to top
 
 
View Profile   IP Logged
bernd
Senior Member
****
Offline



Posts: 229
Munich/Germany
Re: How to increase Accuracy of Ocean output
Reply #1 - Feb 17th, 2010, 1:53am
 
Hi,
you might give aelPushSignifDigits a try.


aelPushSignifDigits( x_digs )
    => x_digs

Places (pushes) a given value onto the stack of values for the number of significant digits the aelEngNotation function uses to create engineering notation strnums. Many functions call the aelEngNotation function indirectly and can request different numbers of significant digits.  


* bernd
Back to top
 
 

Just another lonesome cad guy
View Profile WWW   IP Logged
AmiyaB
New Member
*
Offline



Posts: 8
Kolkata
Re: How to increase Accuracy of Ocean output
Reply #2 - Feb 17th, 2010, 2:51am
 
Hi Bernd,

That command ( aelPushSignifDigits( x_digs )) is not working.

In Ocean Reference manual Version 5.1.41, I got the following command to set precision. Commands are :

setup( [?numberNotation s_numberNotation] [?precision x_precision]
[?reportStyle s_reportStyle] [?charsPerLine x_charsPerLine]
[?messageOn g_messageOn] )
=> t / nil

x_precision Specifies the number of significant digits that are printed.
Valid values: 1 through 16
Default value: 6

Command used :

setup( ?precision 15)

Next I entered a value to Ocean prompt :
ocean> 1.4837505300369085E-7
1.483751e-07 ------- this is the result i got, which is again 5 decimal correct.

So, Can you tell which command to use to set the Ocean Environment.

Regards,

Amiya
Back to top
 
 
View Profile   IP Logged
Andrew Beckett
Senior Fellow
******
Offline

Life, don't talk to
me about Life...

Posts: 1742
Bracknell, UK
Re: How to increase Accuracy of Ocean output
Reply #3 - Feb 17th, 2010, 3:25am
 
OK, that's just the default print representation of a floating point number in SKILL.

The calculations and storage are actually double precision numbers, but the default is to print them in a compact form, effectively single precision.

If  you use:

printf("%.14e\n" num)

it will print to 14 digits.

Or for simple values you want to see at the prompt, or print with println() etc, you can use:

sstatus(fullPrecision t)

This will mean that if you do your example, it will print to much greater precision (14 digits). Note that floating point numbers are actually stored to roughly 15 significant digits (52 bit mantissa, so it's 52*log10(2)). So that's one part in 1e15. With a number which is of the order of 1e-7, the resolution is of the order of 1e-22.

Regards,

Andrew.

Back to top
 
 
View Profile WWW   IP Logged
AmiyaB
New Member
*
Offline



Posts: 8
Kolkata
Re: How to increase Accuracy of Ocean output
Reply #4 - Feb 17th, 2010, 4:29am
 
Hi Andrew,

Thanks a lot for your help.

printf("%.14e\n" num)  -- this is giving results rounded up to 6th decimal padded by zeros till 14th decimal, like
ocean> printf("%.14e\n" 1.4837505300369085E-7)
ocean> 1.48375100000000e-07

The Other command,

sstatus(fullPrecision t)

This command is giving results accurate upto 10^-21.

Thanks and Regards,

Amiya
Back to top
 
 
View Profile   IP Logged
Andrew Beckett
Senior Fellow
******
Offline

Life, don't talk to
me about Life...

Posts: 1742
Bracknell, UK
Re: How to increase Accuracy of Ocean output
Reply #5 - Feb 19th, 2010, 8:25am
 
The printf() result really surprised me, but I've figured out why.

It's to do with the fact that anything you type in at the OCEAN prompt gets read, and then sent to the hidden CIW. Because of this it's parsed, and this is truncating the number (unless you have fullPrecision t set).

I think this is a bug, so I've filed a CCR 753989 for it.

As an alternative, if you run "virtuoso -nographE" rather than "ocean" (in IC61X) or "icms -nographE" (in IC5141), then the printf works properly.

Regards,

Andrew.
Back to top
 
 
View Profile WWW   IP Logged
Pages: 1
Send Topic Print
Copyright 2002-2024 Designer’s Guide Consulting, Inc. Designer’s Guide® is a registered trademark of Designer’s Guide Consulting, Inc. All rights reserved. Send comments or questions to editor@designers-guide.org. Consider submitting a paper or model.