Using 'double x' in VC++ gives 'float x'?

Using 'double x' in VC++ gives 'float x'?

Post by Glenn Carve » Fri, 22 Oct 1999 04:00:00



I'm working with VC++ 6. I have a dialogue set up in which I want to
input x and y coordinates. I've used the Class Wizard to assign a
'double' to the text box value as I need enough sig. figs. for this to
work correctly. However, when I write the numbers out to a file, I'm
only getting 5 sig. figs. (i.e. a 'float x') rather than the 10 or so
I'd expect from a 'double'.   The dialogue will also truncate the
precision as well; if you try entering 9 sig. figs. and refresh the
dialogue it will round it down to 5.

I may well be doing something wrong but I can't see it and I've been
stuck on this for a while. I guess it could be a bug in VC++ 6.

If anyone has the solution or ideas, I'd be grateful.

  Glenn

--

----
Dr. Glenn Carver, Senior Research Associate,
Centre for Atmospheric Science, Chemistry Dept., Cambridge University,
UK  

http://www.atm.ch.cam.ac.uk/~glenn/

              "I never think of the future, it comes soon enough"
                   - Albert Einstein

 
 
 

Using 'double x' in VC++ gives 'float x'?

Post by Mark Richard » Fri, 22 Oct 1999 04:00:00


Maybe Q131993 can help you understand what is going on.  I am sorry I
do not have my compiler on this system, so I cannot do more than look
at the msdn help.  Maybe this is related to the old C gotcha: sprintf
writes out doubles, sscanf reads in floats, if used without being
carefull.

Mark


> I'm working with VC++ 6. I have a dialogue set up in which I want to
> input x and y coordinates. I've used the Class Wizard to assign a
> 'double' to the text box value as I need enough sig. figs. for this
to
> work correctly. However, when I write the numbers out to a file, I'm
> only getting 5 sig. figs. (i.e. a 'float x') rather than the 10 or
so
> I'd expect from a 'double'.   The dialogue will also truncate the
> precision as well; if you try entering 9 sig. figs. and refresh the
> dialogue it will round it down to 5.

> I may well be doing something wrong but I can't see it and I've been
> stuck on this for a while. I guess it could be a bug in VC++ 6.

> If anyone has the solution or ideas, I'd be grateful.

>   Glenn

> --

> ----
> Dr. Glenn Carver, Senior Research Associate,
> Centre for Atmospheric Science, Chemistry Dept., Cambridge
University,
> UK

> http://www.atm.ch.cam.ac.uk/~glenn/

>               "I never think of the future, it comes soon enough"
>                    - Albert Einstein


 
 
 

1. MSVC++: default for 'char' changed from 'unsigned' to 'signed'?

I have to bring back to life an application that had been developed in
MSVC++ 2.0. I understand that the default type for the unspecified 'char'
data type is 'signed', but I have heard that it used to be 'unsigned' for
the older versions of the compiler, so that I should probably use the /J
compiler option when using the code base in newer versions.

Does anyone know anything about this issue?

Thanks
       Judith  Retief

2. S5 in Germany wehn??

3. EXECUTE permission denied on 'sp_sdidebug', database 'master', owner 'dbo'

4. Looking for debuggers for WATCOM C++

5. ODBC driver error '80004005' - couldn't find file '(unknown)'

6. Categories and Protocols in OMT?

7. Additional information: Font 'Times New Roman' doesn't support style 'Regular'.

8. Picture box control

9. Problem with DAO in .NET ('UNICODE' and 'MFC as shared DLL')

10. Method 'Open' of object '_Connection' failed

11. sqlDataReader's .item doesn't work with 'bit' fields?

12. Comparison of '.NET SqlClient' and 'OLEDB' for accessing MSSQL 7 and above

13. Column name 'Translate' causes 'Unspecified Error' when updating.