🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.migration
2 messages
2 total messages Started by David M Wed, 09 Aug 2006 02:53
C++ Builder 6 / 2006 floating point differences (and a crash)
#181
Author: David M
Date: Wed, 09 Aug 2006 02:53
31 lines
2254 bytes
Hi,

Recently we converted a large project to C++Builder 2006 from 6, and the 
conversion has gone fine and the software works perfectly, except for one 
odd issue.  Sometimes there are odd floating point exceptions in code that 
worked fine with CB6, and isn't code you'd expect to cause an exception.

The specific example I'm trying to figure out at the moment is calling a 
getter method on a class which returns a double:
    double dMax = foo.GetMax();
where GetMax is defined as:
    double FooClass::GetMax() { return m_dMax; }
and using it:
    bar->SetGeometry(dMin, dMax);
will throw an EInvalidOp either in the GetMax method or when entering the 
SetGeometry method before the first line of code is executed.

The value of dMax in this case is very small, but as far as I know that 
shouldn't matter.  No maths is being done with it at this stage, it's just 
being passed around.  So, why is there a EInvalidOp exception?  (And what 
operation would it be in the first place, that's invalid?  Nothing is 
actually being done to it...?)

I've googled for similar problems and found a couple of other people who've 
reported the same thing, again after transitions to 2006 from 6, but no 
answers as to the cause or a solution.  If anyone has any insight, it would 
be much appreciated!

Cheers,

David
Re: C++ Builder 6 / 2006 floating point differences (and a crash)
#182
Author: Joe Pasquariello
Date: Fri, 15 Sep 2006 15:27
47 lines
2705 bytes
Hi David,

This may be relevant. A floating point exception can be caused simply by
assigning an invalid value to a variable. You don't have to "use" the value
to get an exception.

Joe


"David M" <davidm@sonardata.com> wrote in message
news:44d94e46@newsgroups.borland.com...
> Hi,
>
> Recently we converted a large project to C++Builder 2006 from 6, and the
> conversion has gone fine and the software works perfectly, except for one
> odd issue.  Sometimes there are odd floating point exceptions in code that
> worked fine with CB6, and isn't code you'd expect to cause an exception.
>
> The specific example I'm trying to figure out at the moment is calling a
> getter method on a class which returns a double:
>     double dMax = foo.GetMax();
> where GetMax is defined as:
>     double FooClass::GetMax() { return m_dMax; }
> and using it:
>     bar->SetGeometry(dMin, dMax);
> will throw an EInvalidOp either in the GetMax method or when entering the
> SetGeometry method before the first line of code is executed.
>
> The value of dMax in this case is very small, but as far as I know that
> shouldn't matter.  No maths is being done with it at this stage, it's just
> being passed around.  So, why is there a EInvalidOp exception?  (And what
> operation would it be in the first place, that's invalid?  Nothing is
> actually being done to it...?)
>
> I've googled for similar problems and found a couple of other people
who've
> reported the same thing, again after transitions to 2006 from 6, but no
> answers as to the cause or a solution.  If anyone has any insight, it
would
> be much appreciated!
>
> Cheers,
>
> David
>
>
>
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads