On Aug 16, 3:23 pm, "Jim Langston" <tazmas...@rocketmail.com> wrote:
"mike3" <mike4...@yahoo.com> wrote in message
news:1187294268.750619.215560@x40g2000prg.googlegroups.com...
On Aug 15, 6:40 pm, "Jim Langston" <tazmas...@rocketmail.com> wrote:
"mike3" <mike4...@yahoo.com> wrote in message
news:1187224319.673432.36480@l22g2000prc.googlegroups.com...
On Aug 15, 3:31 pm, Frank Birbacher <bloodymir.c...@gmx.net>
wrote:
Hi!
mike3 schrieb:
I tried it, thing still fails. It seems to
happen with operators that return "BigFloat"
and not "constBigFloat&".
It seems there is something wrong with your copy constructor. But
your
code is to complex for manual analysis. Can you possibly cut your
code
down to a little working example which shows the error? Maybe
drop all
but one operator (i.e. +) and all sourrounding code?
Frank
See the thing is though that the problem
only became evident when it was used in a complex
program. But not using the offending area of code
seems to cause the problem to disappear. But I
can't just not use the code and I want the thing
to work.
Copy your program to a new program. Start reducing the size trying
to get
it
to compile in a small a size as possible still showing thebug.
Removing
things from the class that shouldn't be necessary to show
thebugetc...
Either you'll reduce the program to something small enough to show
us, or
you'll remove something and the program will stop working or
thebugwill
go
away. At this point it might come up, "Oh, THAT'S why it's
happening!"
I've tried using debugger output functions to display messages that
wouldt
tell me what gets called, etc. before the crash and isolated it to
something
that uses memory (go figure), but it only fails when BigFloats are
used.
And that's where I'm stumped. Is thebugin BigFloat, or this? It's
this
peculiar interaction between BigFloat and this other thing that
doesn't make
any sense. None of them are supposed to overflow. And it's only when
"BigFloat"-returning operators get used in that thing I showed.
This is so strange.
It sounds like BigFloats may be overflowing some buffer somewhere and
screwing up the memory. Can you post the entire BigFloat class?
It's not a simple thing -- over 5700 lines of code. This is
because it contains several implementations of the
arithmetic algorithms, some of which are trimmed-down versions
that are used in more time-critical areas of the program (ie.
fewer branch points, etc.). For example there's a "small integer"
multiply/divide that allows for easier multiplication/division
of BigFloats by small integers. I don't have a "small integer"
add/subtract yet since I haven't needed that operation in any
time-critical area and hence just fake it by constructing a
temporary BigFloat that is equal in value to a small integer.
There are also "fast" add/sub/mul routines that assume equal-sized
operands, for example, and hence don't do any resizing or
pointer gymnastics (hence reducing branch points/"if"s) and have
various optimizations (for instance the "fast add" and "fast sub"
routines use a loop that contains a bit shift and an add/sub
merged into one.).