QIF Import fails out of CVS

Bill Gribble grib@gnumatic.com
Tue, 13 Feb 2001 16:18:00 -0600


On Tue, Feb 13, 2001 at 04:35:37PM -0500, Derek Atkins wrote:
> Converting this to scheme, step-by-step, assuming some value for num:
> 
> guile> (define num 12345678901234567890)
> guile> (define mask 65535)
> guile> (define mag (abs num))
> guile> (logand mag mask)
> ERROR: In procedure logand in expression (logand mag mask):
> ERROR: Wrong type argument in position 1: 12345678901234567890
> ABORT: (wrong-type-arg)

Good!  That means my work in fixing the gnc-helpers.c code wasn't
wasted :)  Of course the patch I just sent answers the question "why
were we passing such a huge number to gnc_scm_to_gint64?" 

The problem is that guile-1.3 logand requires fixnum args, and big
numbers aren't fixnums.  I believe that by reducing the range with ash
we can fix the problem, though it's not done yet (the current
gnc-helpers.c doesn't ensure that both args are fixnums) -- by fixing
the log10 thing that was causing the big values, gnucash will start
working again, but the underlying scm_to_gint64 is still theoretically
broken.

> guile> (ash mag -62)
> 2
> 
> I'm not sure what "ash" does precisely.  Even the C code is a bit
> obfuscated.  

"Arithmetic Shift".  the equivalent of the C << and >> operator.

Let me know if I was right about the log10 fixing everything..

b.g.