Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.misc > #2791

Re: BASIC is 50

From "BartC" <bc@freeuk.com>
Newsgroups comp.misc
References (7 earlier) <Y8ocv.64639$8%2.40203@fx06.am4> <537246b1$0$59749$c3e8da3$e074e489@news.astraweb.com> <JJtcv.95786$Sp6.12404@fx15.am4> <XOtcv.72133$Ch2.21998@fx13.am4> <5372c23d$0$17205$c3e8da3$dd9697d2@news.astraweb.com>
Subject Re: BASIC is 50
Message-ID <I9Gcv.91670$vt2.2348@fx36.am4> (permalink)
Organization virginmedia.com
Date 2014-05-14 09:51 +0100

Show all headers | View raw



"Rich" <rich@example.com> wrote in message 
news:5372c23d$0$17205$c3e8da3$dd9697d2@news.astraweb.com...
> BartC <bc@freeuk.com> wrote:
>> "BartC" <bc@freeuk.com> wrote in message
>> news:JJtcv.95786$Sp6.12404@fx15.am4...
>
>> > The following is an example of how it can be done (see main()). 
>> > Actually,
>
>> A couple of the printfs were messed up.
>
>> A fixed, downloadable version is here:
>
>> http://pastebin.com/0TRdD52q
>
> Nice.  An educational read.  Thanks for that one.

Odd how slight changes creep in between testing and posting! (I think 
because one compiler out of seven had trouble with it and I was trying to 
find out why.)

 I couldn't edit the 'guest' version above. But if someone wants to run the 
code, it's best to change the "(%f)" in str_dec() to "(%.28f)", or use this 
version:

http://pastebin.com/uwpzHLH6

which shows the decimal results accompanied by a more precise internal 
representation, to highlight that the underlying values still have the 
inaccuracies, yet do not affect the ability to emulate decimal arithmetic.

There is still the problem that a result ending in more or less exactly 
x.xx5 (using 2 decimal places) can be rounded either up or down depending on 
slight differences in the floating point representation between machines. 
However that would be an issue with true decimal arithmetic too (what is 
half of 0.99 expressed to 2 decimals places?). But I think that whatever 
behaviour is stipulated for such matters, could also be emulated.

-- 
Bartc 

Back to comp.misc | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

BASIC is 50 Gordon Henderson <gordon+usenet@drogon.net> - 2014-04-30 09:34 +0000
  Re: BASIC is 50 Ant <ant@zimage.comANT> - 2014-04-30 03:42 -0700
    Re: BASIC is 50 Bob Eager <news0002@eager.cx> - 2014-04-30 10:46 +0000
      Re: BASIC is 50 Gordon Henderson <gordon+usenet@drogon.net> - 2014-04-30 12:03 +0000
  Re: BASIC is 50 Rich <rich@example.com> - 2014-04-30 11:12 +0000
    Re: BASIC is 50 scott@alfter.diespammersdie.us (Scott Alfter) - 2014-04-30 15:56 +0000
      Re: BASIC is 50 Rich <rich@example.com> - 2014-04-30 20:41 +0000
        Re: BASIC is 50 Will Honea <whonea@whonea.net> - 2014-04-30 18:38 -0600
          Re: BASIC is 50 Rich <rich@example.com> - 2014-05-01 02:38 +0000
            Re: BASIC is 50 Will Honea <whonea@whonea.net> - 2014-04-30 22:50 -0600
      Re: BASIC is 50 Rich <rich@example.com> - 2014-04-30 20:48 +0000
        Re: BASIC is 50 Richard Kettlewell <rjk@greenend.org.uk> - 2014-05-02 09:27 +0100
          Re: BASIC is 50 Tim Streater <timstreater@greenbee.net> - 2014-05-02 09:50 +0100
        Re: BASIC is 50 "BartC" <bc@freeuk.com> - 2014-05-07 10:48 +0100
          Re: BASIC is 50 Tim Streater <timstreater@greenbee.net> - 2014-05-07 10:57 +0100
          Re: BASIC is 50 Huge <Huge@nowhere.much.invalid> - 2014-05-07 11:20 +0000
            Re: BASIC is 50 "BartC" <bc@freeuk.com> - 2014-05-07 13:14 +0100
              Re: BASIC is 50 Marko Rauhamaa <marko@pacujo.net> - 2014-05-07 16:05 +0300
                Re: BASIC is 50 Paul Sture <nospam@sture.ch> - 2014-05-08 18:06 +0200
                Re: BASIC is 50 Marko Rauhamaa <marko@pacujo.net> - 2014-05-08 20:17 +0300
              Re: BASIC is 50 "James Harris" <james.harris.1@gmail.com> - 2014-05-07 16:08 +0100
                Re: BASIC is 50 "BartC" <bc@freeuk.com> - 2014-05-07 18:38 +0100
                Re: BASIC is 50 "James Harris" <james.harris.1@gmail.com> - 2014-05-07 19:09 +0100
                Re: BASIC is 50 Huge <Huge@nowhere.much.invalid> - 2014-05-07 19:08 +0000
              Re: BASIC is 50 greymausg@mail.com - 2014-05-08 10:15 +0000
                Re: BASIC is 50 "BartC" <bc@freeuk.com> - 2014-05-08 11:38 +0100
              Re: BASIC is 50 Paul Sture <nospam@sture.ch> - 2014-05-08 17:55 +0200
          Re: BASIC is 50 Paul Sture <nospam@sture.ch> - 2014-05-08 17:44 +0200
          Re: BASIC is 50 Rich <rich@example.com> - 2014-05-12 12:39 +0000
            Re: BASIC is 50 Marko Rauhamaa <marko@pacujo.net> - 2014-05-12 16:06 +0300
            Re: BASIC is 50 Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-05-12 22:48 +0100
              Re: BASIC is 50 Rich <rich@example.com> - 2014-05-13 12:03 +0000
                Re: BASIC is 50 "BartC" <bc@freeuk.com> - 2014-05-13 13:23 +0100
                Re: BASIC is 50 Rich <rich@example.com> - 2014-05-13 16:22 +0000
                Re: BASIC is 50 "BartC" <bc@freeuk.com> - 2014-05-13 19:42 +0100
                Re: BASIC is 50 "BartC" <bc@freeuk.com> - 2014-05-13 19:49 +0100
                Re: BASIC is 50 Rich <rich@example.com> - 2014-05-14 01:09 +0000
                Re: BASIC is 50 "BartC" <bc@freeuk.com> - 2014-05-14 09:51 +0100
                Re: BASIC is 50 bde@besplex.bde.org (Bruce Evans) - 2014-05-14 10:36 +0000
                Re: BASIC is 50 "BartC" <bc@freeuk.com> - 2014-05-14 12:58 +0100
                Re: BASIC is 50 bde@besplex.bde.org (Bruce Evans) - 2014-05-14 16:13 +0000
                Re: BASIC is 50 "BartC" <bc@freeuk.com> - 2014-05-14 19:24 +0100
                Re: BASIC is 50 Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-05-13 15:50 +0100
    Re: BASIC is 50 Johny B Good <johnny-b-good@invalid.ntlworld.com> - 2014-05-01 02:50 +0100
    Re: BASIC is 50 David Hume <David.Hume@example.com> - 2014-05-01 09:06 +0100
      Re: BASIC is 50 Gordon Henderson <gordon+usenet@drogon.net> - 2014-05-01 09:56 +0000
      Re: BASIC is 50 Rich <rich@example.com> - 2014-05-01 10:25 +0000
        Re: BASIC is 50 Marko Rauhamaa <marko@pacujo.net> - 2014-05-01 16:43 +0300
          Re: BASIC is 50 Gordon Henderson <gordon+usenet@drogon.net> - 2014-05-01 18:03 +0000
          Re: BASIC is 50 Bob Eager <news0002@eager.cx> - 2014-05-01 21:35 +0000
        Re: BASIC is 50 Rob <monst.oorzudo@ntlworld.com> - 2014-05-01 22:41 +0100
          Re: BASIC is 50 David Hume <David.Hume@example.com> - 2014-05-02 09:26 +0100
            Re: BASIC is 50 Hils <hils@saynotospam.net> - 2014-05-02 10:46 +0100
            Re: BASIC is 50 Johny B Good <johnny-b-good@invalid.ntlworld.com> - 2014-05-02 23:11 +0100
  Re: BASIC is 50 Anssi Saari <as@sci.fi> - 2014-04-30 17:51 +0300
  Re: BASIC is 50 Peter Percival <peterxpercival@hotmail.com> - 2014-05-14 17:40 +0100

csiph-web