Re: problem assigning double as defaultvalue
From: Kirill Stoimenov (kirill_stoimenov_at_yahoo.com)
Date: 04/27/04
- Next message: Egbert Nierop \(MVP for IIS\): "Re: atldbcli.h line 6200 (VC 7.1):"
- Previous message: Brian Muth: "Re: atldbcli.h line 6200 (VC 7.1):"
- In reply to: Alexander Nickolov: "Re: problem assigning double as defaultvalue"
- Next in thread: Sascha Herpers: "Re: problem assigning double as defaultvalue [getting OT]"
- Reply: Sascha Herpers: "Re: problem assigning double as defaultvalue [getting OT]"
- Messages sorted by: [ date ] [ thread ]
Date: 27 Apr 2004 14:09:13 -0700
Hi,
I feel like the word ignorance is used a bit strong here. I know that
some people know more than others, but I think we all deserve respect
and people come to this newsgroup not to be treaded as lower form of
life but to get help...
Kirill
"Alexander Nickolov" <agnickolov@mvps.org> wrote in message news:<OIpVdVcKEHA.3916@TK2MSFTNGP10.phx.gbl>...
> It's more like ignorance on you part really... This behavior is
> by design - floating point arithmetics is imprecise. You should
> never compare floating point numbers directly (especially the
> results of computations). Have you studied interval arithmetics?
> What about computational methods? You should have studied
> about error accumulation... Anyway, the point is, you should
> compare two floating point numbers by subtracting them and
> comparing the absolute of the difference against your precision
> threshold. If it is under the threshold, the numbers are the same,
> otherwise they differ.
>
> --
> =====================================
> Alexander Nickolov
> Microsoft MVP [VC], MCSD
> email: agnickolov@mvps.org
> MVP VC FAQ: http://www.mvps.org/vcfaq
> =====================================
> "Sascha Herpers" <formefromnews@brainpowered.de> wrote in message
> news:c6bavj$a8mkg$1@ID-144102.news.uni-berlin.de...
> > > Looks like it gets stored as float somewhere along the line, either in
> > > the TLB or in MIDL internal structures. Or, MIDL has problem accurately
> > > parsing floating point literals. You see, double gives you precision to
> > > about 15 decimal digits, and float provides only 7-8. The number you get
> > > from default value is accurate to 7 decimal digits.
> > I see. That's probably the reason why casting it to double like this:
> > defaultvalue((double) 0.00001)
> > gave a totally different result. MIDL seems to somehow misinterprete the
> > constant...
> >
> > Oh well...just another thing I will mark as "don't worry about it, you
> > can't change it anyways" kind of thing... :(
> >
> > Thanks Igor.
> > Sash
- Next message: Egbert Nierop \(MVP for IIS\): "Re: atldbcli.h line 6200 (VC 7.1):"
- Previous message: Brian Muth: "Re: atldbcli.h line 6200 (VC 7.1):"
- In reply to: Alexander Nickolov: "Re: problem assigning double as defaultvalue"
- Next in thread: Sascha Herpers: "Re: problem assigning double as defaultvalue [getting OT]"
- Reply: Sascha Herpers: "Re: problem assigning double as defaultvalue [getting OT]"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|