Re: Numbers and calculations and strange things

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Manuel Meitinger (csaf2817_at_uibk.ac.at)
Date: 11/29/04


Date: Mon, 29 Nov 2004 18:53:47 +0100

Have you checked if _controlfp(0,0) returns the same value?
If not, the floating-point handling is different.

"Mateusz Łoskot" <check@my.signature.net> schrieb im Newsbeitrag
news:JJuqd.54170$ha.48890@news.chello.at...
> Hi,
>
> I have a real problem and I'm seriously confused having no idea what is
> going on. I believe someone is able to explain me that.
>
> I'm doing some spherical trigonometry calculations in my application and I
> use one function, let say it is called CALCULATE, which implements some
> algorithm and returns double number as a result. For better understanding
> of my later explanations I can say that the CALCULATE computes area in
> square/area units (m2, km2, spherical degrees, etc.).
>
> I test this function on both eVC++ 4.0 and my iPAQ 2210 and MS VC++ 2003
> on my Windows 2000 (Intel PIII).
>
> The problem is that the CALCULATE function gives me very different results
> on both machines, for the same input data !!!
>
> Here are sample results which I get from my CALCULATE:
>
> First, I get the result in sperical degrees:
>
> VC++ 2003: 3.9536637543773154e-009
> eVC++ 4.0: 2.8474172550380e-009
>
> NOTE: Here you can see how different are those results (?)
>
> Second, I convert it (spherical degrees) to more readable units:
>
> 1) multiply it by constant 707632.4 to get square kilometers (km2):
>
> VC++ 2003: 0.0027977405713030304
> eVC++ 4.0: 0.0020149247059840
>
> 2) multiply it by constant 710010963049.73752482656869140624 to get square
> meters (m2):
>
> VC++ 2003: 2807.1446098202787
> eVC++ 4.0: 2021.6974674540
>
> So, you can see how big differences I get in every case.
>
> I'm sure for 99.9% that my CALCULATE function is working well, I'm testing
> it for 3 days and on Windows 2000 (on desktop) I get very stable results,
> I even can say I get real results (i.e. real area of my car park ;-)
>
> I debuged it step by step on both: evc++ and vc++ simultaneously and I
> checked every number and results of my CALCULATE internalls.
>
> I can't believe there are such big differences beween iPAQ's CPU
> implementation and PIII implementation
> to give me so different results of my computations.
>
> Any explanation is welcome.
>
> --
> Mateusz Łoskot, mateusz (at) loskot (dot) net
> Registered Linux User #220771, Debian (Sarge)



Relevant Pages

  • Re: Strange results of precise calculations
    ... > I have a real problem and I'm seriously confused having no idea what is ... > I'm doing some spherical trigonometry calculations in my application and I ... > of my later explanations I can say that the CALCULATE computes area in ... > implementation and PIII implementation ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: Strange results of precise calculations
    ... >> I have a real problem and I'm seriously confused having no idea what is ... >> of my later explanations I can say that the CALCULATE computes area in ... I even can say I get real results (i.e. real area of my car park ... >> implementation and PIII implementation ...
    (microsoft.public.windowsce.embedded.vc)