Главная страница | назад





Article #16084: Problems extracting floats from a stream

 Question and Answer Database

FAQ1084C.txt   Problems extracting floats from a stream 
Category   :Install Issues
Platform    :Windows 95
Product    :   BC++4.5x   BC++5.x   TC++Win4.5

Question:

Why do I get floating point stack overflow or zeros
streamed in when I try to read floats?

Answer:


At about the same time that Windows 95 shipped, some BC++
applications that used the overloaded >> operator
to read floats or doubles started to fail. At first,
it was thought that it was System Agent and SAGE.DLL because
removing this or applying the Windows 95 Service Packs
usually made the problem go away.
But really it wasn't SAGE.DLL but a DLL used by SAGE.DLL
that was causing the problem. This DLL is called MSVCRT20.DLL
( MSVCRT.DLL on NT )and the problem is that initialization code
in this DLL alters precision values in the Floating Point processor
thus affecting the operator>> that reads in floats or doubles.
To workaround
1)if on 95 apply all MS service packs
2)if that doesn't do it, consider other apps
  that load this DLL. OCX's might use it and
  actually Windows itself might use it for
  common dialog boxes.
3)try using the RTL function _fpreset()
  to reset the state of the FPU control word

If you want to see the problem in the debugger
add the RTL source code to these functions to
your project so you can set breakpoints in
the overloaded operator>>
\bc5\source\rtl\iostream\isteflt.cpp
\bc5\source\rtl\iostream\istedbl.cpp
\bc5\source\rtl\iostream\isteldbl.cpp

7/2/98 10:32:32 AM
 

Last Modified: 01-SEP-99