division by zero mystery
- From: John Smith <JSmith@xxxxxxxx>
- Date: Thu, 28 Dec 2006 23:33:09 GMT
As a hobby project, I am writing a C library of functions that do operations on complex numbers. I am also porting this code to Visual Basic (v.6) in the form of a calculator. I'm seeing something very odd. Code that generates a division by zero error in VB seems to work correctly in the C routines. For example, it is sometimes necessary to evaluate:
x = atan(b / a) (where a and b are the real and imag parts of a complex number)
This generates a division by zero error in VB when the complex operand is, for example, 0.0 + 1.0i but seems to work correctly in the C routines. That is, I can calculate i ^ i correctly with the C code but get a division by zero error when atan() is evaluated in VB. Any thoughts on why this is happening? Is it just "lucky" undefined behaviour?
JS
.
- Follow-Ups:
- Re: division by zero mystery
- From: user923005
- Re: division by zero mystery
- Prev by Date: Re: question about programming
- Next by Date: Re: division by zero mystery
- Previous by thread: platform independent bit shifting
- Next by thread: Re: division by zero mystery
- Index(es):
Relevant Pages
|