# [ADMB Users] Strange results for simple computation

Johnoel Ancheta johnoel at hawaii.edu
Fri Sep 4 01:45:26 PDT 2009

```Hi Casper,

I may have a fix to the problem.  It turns out, one of the arrays just needed to be
larger.  I'll will verify the fix with the other core developers, then have a update for
you by next week.

For now, the line below needs to be split.
r  = ( lambda(a,a0,a1,a2,b1,b2)*sigmoid(a,alpha,beta,b,rho) + lambda(b,a0,a1,a2,b1,b2)*sigmoid(b,alpha,beta,b,rho) ) * (b - a) / two;

For example,
dvariable A = lambda(a,a0,a1,a2,b1,b2)*sigmoid(a,alpha,beta,b,rho);
dvariable B= lambda(b,a0,a1,a2,b1,b2)*sigmoid(b,alpha,beta,b,rho);
r  = (  A + B ) * (b - a) / two;

This should allow you to continue working, until a updated distribution is
available.

Sorry for the inconvenience,
Johnoel

----- Original Message -----
From: Casper Berg <cbe at aqua.dtu.dk>
Date: Thursday, September 3, 2009 8:45 am
Subject: [ADMB Users] Strange results for simple computation

<font style="font-style: normal; font-weight: normal; background-color: rgb(245, 248, 240); font-size: 14px;">> </font>Strange results for simple computation -----------------------------------------------------------
|

> Hello,

I am experiencing some very strange behaviour in my ADMB-program (small working example attached).
> I use the version from admb-9.0.363-win32-mingw-gcc3.4.zip.

I get the following output:

r = (0.00679635 * 0.0109971 + 0.0188592 * 1)* ((2.5 - -89.3986) / 2) = -2.65884
>  r = (0.00679635 * 0.0109971 + 0.0188592 * 1)* -23.4045 = -2.65884

I expected the following:

r = (0.00679635 * 0.0109971 + 0.0188592 * 1)* ((2.5 - -89.3986) / 2) = 0.8700013
> r = (0.00679635 * 0.0109971 + 0.0188592 * 1)* 45.9493 = 0.8700013

The result of the computation is completely wrong, both the result of the second paranthesis (-23.4 instead of 45.9) and

even if -23.4 was correct, then the final result -2.66 is wrong (should then be -0.44).

I hope someone can explain to me why this voodoo is happening...

best regards,
> Casper Berg.

<<ingestion.tpl>>
|
-----------------------------------------------------------
> _______________________________________________
> Users mailing list