
|
Introduction
Summary of LASCO/EIT What is LASCO? What is EIT? (external link) FAQ Realtime Images RealTime Movies (SOHO Movie Theater) Download LASCO Data Carrington Maps Data Products Image Gallery Movie Gallery Processing Levels FITS Header Keywords Data Policy Wavelet images/movies Coronal Mass Ejections Eclipse Observations LASCO Calibration LASCO C3 Planet transits (via Sungrazer) Team and Operations Resources LASCO/C1 at MPAe (Germany) LASCO at LAS (France) LASCO Handbook Technical Notes Detailed Documentation Acronyms Solwind Images and CMEs SOHO Home page SOHO and SOHO Instruments Other Solar Satellites and Observatories |
OBE C Compiler - Integer Division ErrorWritten: DW - Apr 9, 1997
The National Semiconductor C Version 4.42 compiler for our NS32016 microprocessor
aboard the LEB does not always produce code to divide negative integers correctly.
This line of C code produces incorrect results:
*p = ( (*p>0) ? (*p+d) : (*p-d))/scale;
If (*p+d) is positive all is well but if (*p-d) is negative it always treats
the signed int as an unsigned int! Examining the assembler code showed the mistake.
Example: *p = 0, scale = 10, d = 4
Then *p = -4/10 should be zero in integer arithmetic.
Instead the compiler produces code that does the following :
-4 = 0xfffffffc
10 = 0xa
0xfffffffc / 0xa = 0x19999999 = 429496729 (decimal)
Thus the National Semiconductor answer is -4/10 = 429496729
There is no hope of getting a compiler fix.
---------- begin Include ----------------
National Semiconductor
Customer Response Group
(800) 272-9959
Hello,
In response to your request:
This device was obsoleted a number of years ago. We have no information
available to us on this device and will not be able to help you resolve your
issues.
Please feel free to call our Customer Response Group at (800) 272-9959
if you have additional questions or requests.
Regards,
support@nsc.com
---------- end Include ----------------
Here is the program div.c :
#include
|