[Sussex] Challenge
Geoff Teale
Geoff.Teale at claybrook.co.uk
Wed Apr 30 12:29:01 UTC 2003
Steve wrote:
------------
> The output (in bc) of 1.0 / 1010.0 is:
> .0001100110011001100110011001100110011001100110011001100110011001100\
> 11001100110011001100110011001100110011001100110011001100110011001100\
> 11001100110011001100110011001100110011001100110011001100110011001100\
> 11001100110011001100110011001100110011001100110011001100110011001100\
> 11001100110011001100110011
:)
That looks like what I'd expect to see ;)
> This look like a little more than 53 bits to me! (you did say you
> didn't have bc to hand - install Cygwin as you exit statement to HR
> on your PC).
I installed Cygwin on this machine a while back from a magazine coverdisk,
for some reason this version is missing a lot of stuff (including gcc!) but
has mysql in it.. v.odd.
> But given that:
> 0010.0 * .0001100110011001100...0011 = .0011001100110011001...0110
> and
> 1000.0 * .0001100110011001100...0011 = .1100110011001100110...1001
>
> Then I agree there must be a fiddle factor in there somewhere :-)
Indeed ;)
> Go 2:
>
> 0001.0 = 1.0 * 10^0
> 1010.0 = 1.0 * 10^1010
> 0000.1 = 1.0 * 10^-1010
>
> Therefore when multiplying number one just has to add the exponents
> together:
>
> 0000.1 * 1010.0 = 1.0 * 1010^(-1010 + 1010)
> = 1.0 * 1010^(0)
> = 0001.0
>
> How' that! Of course the mantissa is always 1.0 and the exponent
> is an integer itself so this only works for a limited number of
> values (but no fiddle factor).
Good thinking, but that doesn't escape the problem of expressing 0.1 in
binary, it just sidesteps it. So, whilst it works logically, it isn't in
the spirit of the question - still it shows an interesting way around the
problem (for a limited number of cases) so it carries some merit.
> Mine's still a pint of Horsham Best
We'll see... :)
--
GJT
Free Software, Free Society.
http://www.fsf.org http://www.gnu.org
The above information is confidential to the addressee and may be privileged. Unauthorised access and use is prohibited.
Internet communications are not secure and therefore this Company does not accept legal responsibility for the contents of this message.
If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful.
Claybrook Computing Limited is a subsidiary of Claybrook Computing (Holdings) Limited
Registered Office: Abbey House. 282 Farnborough Road, Farnborough, Hampshire GU14 7NJ
Registered in England and Wales No 1287205
A Hogg Robinson plc company
More information about the Sussex
mailing list