Re: printing double value

From: Francis Glassborow (francis_at_robinton.demon.co.uk)
Date: 07/29/04


Date: Thu, 29 Jul 2004 10:46:28 +0100

In article <M%1Oc.21344$%r.235074@nasal.pacific.net.au>, David White
<no@email.provided> writes
>"Edo" <eddod@eddododod.dod> wrote in message
>news:cea59j$6c2$1@merki.connect.com.au...
>> David White wrote:
>> > Why? You haven't said what's wrong.
>> >
>>
>> well, after
>> >> for(int i=0; i<sizeof(double)*3; ++i){
>> >> pcu[i] = 1;
>>
>> I was thinking the results should be
>> 0
>> 0
>> 0
>> 1.0
>> 1.0
>> 1.0
>> so why came out rubbish?
>
>Because a floating point number is in a reasonably complicated format that
>includes sign bits and an exponent. By writing 1s to its bytes you could be
>doing anything to it. You really need to look up a floating-point format to
>understand.

This thread reminds me of the Oxford graduate chemist (back in the 60s
and 70s Oxford Chemistry degrees had a very large element of practical
in the final examinations.) His first job was in industry. One morning
his boss came in and found him doing a classic boiling point experiment.
The boss asked him why he was doing that. The graduate told him he need
the boiling point of one of the chemicals he was working with. When
asked which one, he responded 'nitroglycerine'.

Which reminds me of the retired safe cracker who was asked by a
journalist where he kept his nitro during his professional life. The
response was 'In a jam (jelly for the colonials:) jar on the
mantlepiece. The police would never believe that such a dangerous
substance would sit where it could so easily be knocked over.'

Doing dangerous things is fine when you understand what you are doing,
but poking around without the slightest idea what the risks are, isn't.

-- 
Francis Glassborow      ACCU
Author of 'You Can Do It!' see http://www.spellen.org/youcandoit
For project ideas and contributions: http://www.spellen.org/youcandoit/projects


Relevant Pages

  • Re: while situations barely melt teachers, the negligences often run for ever the historic reluctanc
    ... Gavin, still floating, rates almost silently, as the wheel approachs ... unless Mohammed conceives symptoms for example Usha's ... tap the minor bottle and merge it in response to its catalogue. ...
    (sci.crypt)
  • Re: Low Pass Filter Design Help
    ... Is it still considered FIR when implemented with a delayed ... differentiator (delay sets the window size) followed by an ... principles of floating point comparison. ... But it is an interesting response, ...
    (comp.dsp)
  • RE: Adding floating point emulation support for MIPS R4300
    ... Thanx for your response. ... Since I already have an image created for a device with FPU, can I make any changes to the existing image to enable this functionality? ... included script samples are subject to the terms specified at ... has a floating point unit, however, I want to use floating point emulation. ...
    (microsoft.public.windowsce.platbuilder)