473,387 Members | 1,453 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Floating Point Exception

Hi,
I have a problem regarding handling floating point error, specially
Denormalisation error. I want to know is there any trick or technique
to find bit length of the resultant before using and floating point
operation.

e.g

before using
pow(0.5,100000);
I can precisely detect that this operation will give DE error.

Thanks in advance.

shhnwz.a

Feb 15 '07 #1
1 2739
On Feb 15, 12:33 am, "Shhnwz.a" <mshahnawaz...@gmail.comwrote:
Hi,
I have a problem regarding handling floating point error, specially
Denormalisation error. I want to know is there any trick or technique
to find bit length of the resultant before using and floating point
operation.

e.g

before using
pow(0.5,100000);
I can precisely detect that this operation will give DE error.
That should result in a complete loss of precision (some compilers
will have TLOSS as an exception mask for instance) and not
denormalization (which is only partial loss of precision).

You could (of course) use mathematics and reason things out using
first principles. I think that the following approach is much
simpler: If your compiler allows it, you could simply turn floating
point exceptions on and add underflow and/or denormalization to the
mask of opertations to trap. I guess that the work to detect the
problems before they happen is far more expensive than the actual
operations themselves.

Another possibility is to use an arbitrary precision floating point
library and check the ranges of the values before converting them to
double or whatever your intended target precision is.

What is the actual problem that you are trying to solve?

Feb 15 '07 #2

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

Similar topics

1
by: Andrew Straw | last post by:
I'm running into trouble when calling a 3rd party library (the Intel IPP library to do some fast math on a P4 processor). This is on debian linux 2.6.7 using python 2.3.4. I've been using Pyrex...
10
by: Vinny | last post by:
I have a few floating point questions/issues I wish to ask. An answer or discussion would be nice too :) Any links discussion the subject would be nice too.. 1. How do I generate an underflow...
687
by: cody | last post by:
no this is no trollposting and please don't get it wrong but iam very curious why people still use C instead of other languages especially C++. i heard people say C++ is slower than C but i can't...
21
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...
2
by: Steven Jones | last post by:
Im just learning C an do not understand why the following code fails. The while loop apperas to work fine until it bombs out with a floating point exception. Whats going on? Thanks /* *...
13
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....
4
by: jacob navia | last post by:
Hi people I continue to work in the tutorial for lcc-win32, and started to try to explain the floating point flags. Here is the relevant part of the tutorial. Since it is a difficult part, I...
2
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? ~...
39
by: rembremading | last post by:
Hi all! The following piece of code has (for me) completely unexpected behaviour. (I compile it with gcc-Version 4.0.3) Something goes wrong with the integer to float conversion. Maybe somebody...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...

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.