Re: printing double value
From: Francis Glassborow (francis_at_robinton.demon.co.uk)
Date: 07/29/04
- Next message: David White: "Re: printing double value"
- Previous message: Francis Glassborow: "Re: printing double value"
- In reply to: David White: "Re: printing double value"
- Next in thread: David White: "Re: printing double value"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: David White: "Re: printing double value"
- Previous message: Francis Glassborow: "Re: printing double value"
- In reply to: David White: "Re: printing double value"
- Next in thread: David White: "Re: printing double value"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|