embedded systems developers tools, cross compilers
  Home  |   SwiftX Archive  |   SwiftForth Archive  |

Re: Handling really large numbers, dynamic ranges....

From: Bill Hall <bill.hall_at_vpl.varianinc.com>
Date: Tue, 03 Sep 2002 14:42:41 -0400

hi
First I must ask what is the expected domain of the resultant y ?
I ran 12,000,000 thru the equation you gave, and y goes way past 32 bits,
in the negative direction.

One suggestion is to rearrange the equation as follows:

y = (((a)x + b)x + c)x +d .

Then evaluate it as follows

Multiply: y = ax
Add: y = ax+b
Multiply: y = (ax+b)x = ax2 + bx
Add: y = ax2 + bx + c
Multiply: y = (ax2 + bx + c)x = ax3+bx2+cx
Add: y = ax3+bx2+cx+d

But a is so small that you will need to scale the result UP to
obtain any
integer effect from the a term. Which leads me back to the first
question
because it is the a term that causes the result to go beyond 32 bits
negative.

You may be able to pick a scaling denominator for the data and use */ ,
thinking of the data as a fraction of some "full scale" like 16777216.

You will then probably have to express your coefficients in some other way.

With logs, you will lose lots of precision.

Hope this helps in some small way.

At 10:57 AM 9/3/02 -0700, Gene Silvernail wrote:
>I have some data that extends into the 18 to 24 bit range and of course
>it changes over temperature. I'm measuring temp also.
>Our measured noise coming off the A/D is +/- 10, very very quiet
>
>Non-linear regression is getting to be a bugger as the numbers can
>become very large even at the 3rd order. The max number that I can
>Effectively cube is something like 1290 which gets you to the top of
>double precision signed numbers. The 3rd degree poly below is a good
>example.
>
>I have data that tops somewhere around 12,000,000 and at the low end
>its around 100,000. If I start pre-scaling then I'm into keeping track
>of how much pre-scaling to apply verses loss of resolution... LOGS?
>
>John Harts book which is referenced in the SwiftX refs is out of print.
>I've tried to locate a used one without luck.
>
>Any ideas
>
>Gene Silvernail
>
>
>
>
>y = -7.0970E-11x3 + 2.0936E-06x2 - 2.4255E-02x + 1.6214E+02
>
>
>----------------------------------------------------------------------
>swiftx_at_forth.com The SwiftX programming discussion email list
>To unsubscribe, send subject "unsubscribe swiftx" to listar_at_forth.com
>For help with listar commands, send subject "help" to listar_at_forth.com
>Archives are located at http://www.forth.com/swiftx -- check them out!
>----------------------------------------------------------------------
>THIS LIST IS NOT FOR BUG REPORTS! Send bug reports to support_at_forth.com.
>
MrBill
~|:)>>>>
----------------------------------------------------------------------
swiftx_at_forth.com The SwiftX programming discussion email list
To unsubscribe, send subject "unsubscribe swiftx" to listar_at_forth.com
For help with listar commands, send subject "help" to listar_at_forth.com
Archives are located at http://www.forth.com/swiftx -- check them out!
----------------------------------------------------------------------
THIS LIST IS NOT FOR BUG REPORTS! Send bug reports to support_at_forth.com.
Received on Tue Sep 03 2002 - 11:42:27 PDT

This archive was generated by hypermail 2.2.0 : Mon Dec 01 2008 - 03:04:47 PST