473,698 Members | 2,005 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Exception class EInvalidOp: invalid floating point operation (x-posted w/ borland.cppbuil der.cpp)

Hello,

I am working on a project in Borland Developer Studio 2006, and am
running into an error I
don't understand. Here is the relevant code:

//---------------------------------------------------
double splitLoc = 0, fs = 512;
double timeRange[3];
int tArr[3];

// these values come from a file, and just happen to be in the one I am
using now
timeRange[0] = -1.5;
tArr[0] = 0;
tArr[2] = 0;

// This is where the error occurs
splitLoc += timeRange[0] * fs; //this is fine
splitLoc += (double)(tArr[2] - tArr[0]);
//----------------------------------------------------

This last line always throws the exception:
First chance exception at $7C81EB33. Exception class EInvalidOp with
message 'Invalid floating point operation'. Process test.exe (3040)

The program compiles fine, so what else could be causing this?
Thanks!
Adam

Feb 19 '06 #1
2 9193
In article <11************ **********@o13g 2000cwo.googleg roups.com>,
"jawilson" <ja******@cae.w isc.edu> wrote:
Hello,

I am working on a project in Borland Developer Studio 2006, and am
running into an error I
don't understand. Here is the relevant code:

//---------------------------------------------------
double splitLoc = 0, fs = 512;
double timeRange[3];
int tArr[3];

// these values come from a file, and just happen to be in the one I am
using now
timeRange[0] = -1.5;
tArr[0] = 0;
tArr[2] = 0;

// This is where the error occurs
splitLoc += timeRange[0] * fs; //this is fine
splitLoc += (double)(tArr[2] - tArr[0]);
//----------------------------------------------------

This last line always throws the exception:
First chance exception at $7C81EB33. Exception class EInvalidOp with
message 'Invalid floating point operation'. Process test.exe (3040)

The program compiles fine, so what else could be causing this?
Thanks!
Adam


I wrapped your code in main and it works fine... If that last line is
throwing an exception, it's being cause by something other than what you
posted. Chances are, some code is going past an array boundary.

--
Magic depends on tradition and belief. It does not welcome observation,
nor does it profit by experiment. On the other hand, science is based
on experience; it is open to correction by observation and experiment.
Feb 19 '06 #2
When I opened the project in C++Builder 6 instead of the new version
(BDS 2006), it ran fine. Nothing in the code changed, and I'm pretty
certain that the code is not going past an array boundary. This seems
to be a borland config issue, and not a C++ issue now, but I'm still
hoping someone might have an answer.
Adam

Feb 19 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
4200
by: Allin Cottrell | last post by:
OK, I realize that what I am asking here is not likely to have a answer within the C standard. Nonetheless, it is not specific to any particular platform, so I'll hazard the question anyway. A C double can be aliased by an array of unsigned char, to which any desired byte pattern may be written. Is there any somewhat portable way of assigning a byte pattern such that the result will, with very high probability, _not_ count as a valid...
13
5166
by: Chris Stankevitz | last post by:
Hi, I have a very large Visual c++ .net 2003 7.1 native c application (approximately 500,000 lines of code). This application is a simulation that frequently works with floating point numbers. From time to time I do something bad -- for example divide by zero or try to grow a float beyond numeric_limits<float>::max() I told MSVC .net 2003 7.1 to "Break into the debugger" for ALL exceptions in
2
3157
by: marko.suonpera | last post by:
I'm using the Newmat library where element access in ColumnVector type is defined as follows: typedef double Real; Real& ColumnVector::operator()(int m) { REPORT if (m<=0 || mnrows) Throw(IndexException(m,*this)); return store;
2
2648
by: Martin Manns | last post by:
Hi, I am experiencing some trouble with gmpy v1.01. Multiplying an mpq with inf results in a floating point exception that exits python. Has this already been fixed in newer gmpy versions? ~ $ python Python 2.4.3 (#1, Mar 26 2007, 00:32:54) on linux2 Type "help", "copyright", "credits" or "license" for more information.
3
3701
by: LSW | last post by:
I'm using Borland Turbo C++ 3.0 to develop an embedded system to shift data around a network. At the moment we receive a string of bytes over a serial line and reassemble them into floating point values. If the bytes are not assembled correctly then it's possible to produce some floating point values that aren't 'genuine' numbers. Does anyone have any suggestions on how to check a float/double is valid (i.e. checking for NANs, infinity...
4
1815
by: mathieu | last post by:
Hi, I am working on an IO library, and I am reading a binary blob which represent a floating point. I would like to know what is the correct way to interpret it. For integer type using a stringstream works like a charm, but for floating point I am getting a behavior that I don't quite understand, for instance (*). BTW NaN is the IEEE with all bit set, right ? What is the representation for infinity ?
0
8671
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8598
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9016
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8887
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8856
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7709
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6515
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4360
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3037
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.