Edge case of no local prices yet
This commit is contained in:
@@ -1609,10 +1609,10 @@ uint32_t komodo_pricenew(int32_t *maxflagp,uint32_t price,uint32_t refprice,int6
|
|||||||
int32_t komodo_pricecmp(int32_t n,int32_t *maxflagp,uint32_t *pricebitsA,uint32_t *pricebitsB,int64_t tolerance)
|
int32_t komodo_pricecmp(int32_t n,int32_t *maxflagp,uint32_t *pricebitsA,uint32_t *pricebitsB,int64_t tolerance)
|
||||||
{
|
{
|
||||||
int32_t i; uint32_t newprice;
|
int32_t i; uint32_t newprice;
|
||||||
*maxflagp = 0;
|
|
||||||
for (i=1; i<n; i++)
|
for (i=1; i<n; i++)
|
||||||
{
|
{
|
||||||
if ( (newprice= komodo_pricenew(maxflagp,pricebitsA[i],pricebitsB[i],tolerance)) != 0 )
|
*maxflagp = 0;
|
||||||
|
if ( pricebitsB[i] != 0 && pricebitsA[i] != 0 && (newprice= komodo_pricenew(maxflagp,pricebitsA[i],pricebitsB[i],tolerance)) != 0 )
|
||||||
{
|
{
|
||||||
fprintf(stderr,"i.%d/%d %u vs %u -> newprice.%u out of tolerance maxflag.%d\n",i,n,pricebitsB[i],pricebitsA[i],newprice,*maxflagp);
|
fprintf(stderr,"i.%d/%d %u vs %u -> newprice.%u out of tolerance maxflag.%d\n",i,n,pricebitsB[i],pricebitsA[i],newprice,*maxflagp);
|
||||||
return(-1);
|
return(-1);
|
||||||
@@ -1624,9 +1624,10 @@ int32_t komodo_pricecmp(int32_t n,int32_t *maxflagp,uint32_t *pricebitsA,uint32_
|
|||||||
// komodo_priceclamp() clamps any price that is beyond tolerance
|
// komodo_priceclamp() clamps any price that is beyond tolerance
|
||||||
int32_t komodo_priceclamp(int32_t n,uint32_t *pricebits,uint32_t *refprices,int64_t tolerance)
|
int32_t komodo_priceclamp(int32_t n,uint32_t *pricebits,uint32_t *refprices,int64_t tolerance)
|
||||||
{
|
{
|
||||||
int32_t i,maxflag = 0; uint32_t newprice;
|
int32_t i,maxflag; uint32_t newprice;
|
||||||
for (i=1; i<n; i++)
|
for (i=1; i<n; i++)
|
||||||
{
|
{
|
||||||
|
maxflag = 0;
|
||||||
if ( (newprice= komodo_pricenew(&maxflag,pricebits[i],refprices[i],tolerance)) != 0 )
|
if ( (newprice= komodo_pricenew(&maxflag,pricebits[i],refprices[i],tolerance)) != 0 )
|
||||||
{
|
{
|
||||||
fprintf(stderr,"priceclamped[%d of %d] %u vs %u -> %u\n",i,n,refprices[i],pricebits[i],newprice);
|
fprintf(stderr,"priceclamped[%d of %d] %u vs %u -> %u\n",i,n,refprices[i],pricebits[i],newprice);
|
||||||
|
|||||||
Reference in New Issue
Block a user