Re: Reading specific memory address into variable
From: Karl Heinz Buchegger (kbuchegg_at_gascad.at)
Date: 10/20/04
- Next message: John Harrison: "Re: Windows App - C++"
- Previous message: Gernot Frisch: "Re: a[3} slower than a.x; a.z; a.z"
- In reply to: David Casey: "Re: Reading specific memory address into variable"
- Next in thread: David Casey: "Re: Reading specific memory address into variable"
- Reply: David Casey: "Re: Reading specific memory address into variable"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 20 Oct 2004 10:59:04 +0200
David Casey wrote:
>
> On Tue, 19 Oct 2004 21:26:51 -0700, Gianni Mariani wrote in
> <news:PZOdnb9TpMCTdOjcRVn-3w@speakeasy.net>:
>
> [snip!]
>
> > When exp is at the limits of what the double can store, the mantissa is
> > not normalized, so you can simply call frexp twice and compare the
> > exponents to be equal both times. Then you can subtract the 2 resulting
> > mantissas and call std::frexp on the result and the exponent on the
> > third call will be the negative of the number of significant binary
> > digits which you can convert to decimal by the siggestion I made earlier.
>
> I hadn't thought of using stuff like that, but I have found a way which
> works great and is about as simple as you can get.
>
> Okay, the variables I'm comparing are a constant which in my program I call
> cons_pi and it equals 3.14159265358979. The user enters an integer number
> for how many times they want to do that calculation to figure out pi (4/1 -
> 4/3 + 4/5 - 4/7 etc.). That calculation is placed into calc_pi. Both
> these numbers are long doubles to get as many decimal places as I can.
>
> Anyway, the teacher wants us to figure the accuracy of our calculated value
> which is where I was stuck trying to figure out a way to compare the two
> numeric values.
Why not simply subtract one from the other?
This gives you a measure how 'close' they are.
Hint: You might also want to apply log() to this difference.
-- Karl Heinz Buchegger kbuchegg@gascad.at
- Next message: John Harrison: "Re: Windows App - C++"
- Previous message: Gernot Frisch: "Re: a[3} slower than a.x; a.z; a.z"
- In reply to: David Casey: "Re: Reading specific memory address into variable"
- Next in thread: David Casey: "Re: Reading specific memory address into variable"
- Reply: David Casey: "Re: Reading specific memory address into variable"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|