pne: A picture of a plush toy, halfway between a duck and a platypus, with a green body and a yellow bill and feet. (Default)
[personal profile] pne

Co-worker trying to convince me that "0.5 is not exactly representable in [binary] floating-point".

Hello? It's exactly 2-1. Of course it's exactly representable!

Maybe you were thinking of 0.1 or something, which isn't representable exactly in binary. But not 0.5.

A little knowledge is a dangerous thing.

Date: Wednesday, 26 November 2003 09:09 (UTC)
From: [identity profile] nik-w.livejournal.com
0.5 in binary is "0.1", isn't it? Long long time since I did binary fp's, tho, so I could be wrong...

Date: Wednesday, 26 November 2003 09:14 (UTC)
ext_78: A picture of a plush animal. It looks a bit like a cross between a duck and a platypus. (Default)
From: [identity profile] pne.livejournal.com
*think briefly*

Yes, it should be. 0.510 = 2-1, so yeah, 0.12 sounds right.

0.110, on the other hand, is 0.110011001100…2—a repeating decimal.

(Hm, I wonder whether this works: 0.11002.)

Date: Wednesday, 26 November 2003 09:27 (UTC)
From: [identity profile] nik-w.livejournal.com
I'm astounded that works - LJ normally strips style info out!

Date: Wednesday, 26 November 2003 09:53 (UTC)
ext_78: A picture of a plush animal. It looks a bit like a cross between a duck and a platypus. (Default)
From: [identity profile] pne.livejournal.com
Hm? It strips out scripts, but CSS works in entries and comments.

(I think it doesn't work in the bio, though.)

Date: Wednesday, 26 November 2003 09:57 (UTC)
From: [identity profile] nik-w.livejournal.com
Ah - I was going off my experience in trying to get stlye info in the bio. Some use making the pages XHTML compatible if the info put into the bio lets it down because you can't use style tags!

Date: Wednesday, 26 November 2003 17:47 (UTC)
From: [identity profile] timwi.livejournal.com
0.110, on the other hand, is 0.110011001100…2—a repeating decimal.

... you mean ... a repeating binary? :-)

Date: Wednesday, 26 November 2003 23:15 (UTC)
ext_78: A picture of a plush animal. It looks a bit like a cross between a duck and a platypus. (Default)
From: [identity profile] pne.livejournal.com
Something like that :)

Profile

pne: A picture of a plush toy, halfway between a duck and a platypus, with a green body and a yellow bill and feet. (Default)
Philip Newton

June 2015

S M T W T F S
 12 3456
78910111213
14151617181920
2122232425 2627
282930    

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Friday, 2 January 2026 00:51
Powered by Dreamwidth Studios