The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl
Simulators >> Circuit Simulators >> How to increase Accuracy of Ocean output
https://designers-guide.org/forum/YaBB.pl?num=1266336043

Message started by amiya on Feb 16th, 2010, 8:00am

Title: How to increase Accuracy of Ocean output
Post by amiya on 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.

Title: Re: How to increase Accuracy of Ocean output
Post by bernd on 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.  


*

Title: Re: How to increase Accuracy of Ocean output
Post by amiya on 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

Title: Re: How to increase Accuracy of Ocean output
Post by Andrew Beckett on 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.


Title: Re: How to increase Accuracy of Ocean output
Post by amiya on 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

Title: Re: How to increase Accuracy of Ocean output
Post by Andrew Beckett on 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.

The Designer's Guide Community Forum » Powered by YaBB 2.2.2!
YaBB © 2000-2008. All Rights Reserved.