Re: Reading specific memory address into variable

From: Karl Heinz Buchegger (kbuchegg_at_gascad.at)
Date: 10/20/04


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


Relevant Pages

  • Re: I hit something I should not have, The subject is still undetermined
    ... Compare one versus the other, ... My first mistake was not to buy it directly from Dell. ... I went to the store, ... bought mine on the 20th. ...
    (microsoft.public.windowsxp.newusers)
  • Re: Canadian OEM distribution remain pricing idiots
    ... I much prefer to give my business to the local guy, assuming he's worthy, of course. ... round of haggling with two or three stores to get the best price. ... what often happens is that Store A has an item in stock and Store B does ... I'd love to compare against the same frames. ...
    (rec.photo.equipment.35mm)
  • Re: LV Poker Room comparisons?
    ... thread made me wonder how the other places compare. ... Not enough higher limits. ... This and stuff like the vibe, are the staff generally happy to be working, ... to the only card room in driving distance the poker room manager had ...
    (rec.gambling.poker)
  • Re: LV Poker Room comparisons?
    ... thread made me wonder how the other places compare. ... Not enough higher limits. ... Wynn: Second best physically but tougher games than most places. ... This and stuff like the vibe, are the staff generally happy to be working, ...
    (rec.gambling.poker)
  • Re: Mask or encrypt field
    ... John Spiegel wrote: ... I just came up with some formula that transforms the password to something that is not readily recognizable and created a function that returns the value in order to store it in that form. ... When you need to test the password, either encrypt the newly entered password using the same function before comparing or write the commensurate decryption method and compare the raw password to the decrypted stored version. ... you might take the first character and convert it to ASCII. ...
    (microsoft.public.fox.programmer.exchange)