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


Groups > comp.lang.c > #13650 > unrolled thread

OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!!

Started by88888 Dihedral <dihedral88888@googlemail.com>
First post2011-11-20 11:12 -0800
Last post2011-11-28 14:59 -0800
Articles 20 on this page of 89 — 25 participants

Back to article view | Back to comp.lang.c


Contents

  OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! 88888 Dihedral <dihedral88888@googlemail.com> - 2011-11-20 11:12 -0800
    Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! Ian Collins <ian-news@hotmail.com> - 2011-11-21 08:18 +1300
    Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! Vincenzo Mercuri <vincenzo.mercuri@yahoo.it> - 2011-11-20 20:22 +0100
      Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! 88888 Dihedral <dihedral88888@googlemail.com> - 2011-11-20 11:23 -0800
        Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-11-20 15:03 -0500
          Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! Kaz Kylheku <kaz@kylheku.com> - 2011-11-20 20:06 +0000
          Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! 88888 Dihedral <dihedral88888@googlemail.com> - 2011-11-20 12:13 -0800
            Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! Ian Collins <ian-news@hotmail.com> - 2011-11-21 09:16 +1300
            Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-11-20 15:37 -0500
    Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2011-11-20 14:15 -0700
    Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! Lew Pitcher <lpitcher@teksavvy.com> - 2011-11-20 13:45 -0800
      Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-11-21 00:44 -0800
        Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-11-21 12:44 +0200
        Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! Lew Pitcher <lpitcher@teksavvy.com> - 2011-11-21 10:41 -0800
      Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! 88888 Dihedral <dihedral88888@googlemail.com> - 2011-11-21 00:53 -0800
        Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! "io_x" <a@b.c.invalid> - 2011-11-24 19:08 +0100
    Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! Martin Ambuhl <mambuhl@earthlink.net> - 2011-11-20 17:32 -0500
      Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! Keith Thompson <kst-u@mib.org> - 2011-11-20 14:55 -0800
        Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! 88888 Dihedral <dihedral88888@googlemail.com> - 2011-11-20 16:54 -0800
          Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! Keith Thompson <kst-u@mib.org> - 2011-11-20 19:35 -0800
            Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-11-22 00:39 -0800
              Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! Keith Thompson <kst-u@mib.org> - 2011-11-22 13:18 -0800
                Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-11-24 01:50 -0800
    Re: Euler's constant jacob navia <jacob@spamsink.net> - 2011-11-21 12:45 +0100
      Re: Euler's constant Vincenzo Mercuri <vincenzo.mercuri@yahoo.it> - 2011-11-21 13:54 +0100
        Re: Euler's constant jacob navia <jacob@spamsink.net> - 2011-11-21 14:48 +0100
          Re: Euler's constant Vincenzo Mercuri <vincenzo.mercuri@yahoo.it> - 2011-11-21 18:58 +0100
      Re: Euler's constant Markus Wichmann <nullplan@gmx.net> - 2011-11-21 14:10 +0100
        Re: Euler's constant jacob navia <jacob@spamsink.net> - 2011-11-21 15:36 +0100
          Re: Euler's constant 88888 Dihedral <dihedral88888@googlemail.com> - 2011-11-21 07:08 -0800
            Re: Euler's constant jacob navia <jacob@spamsink.net> - 2011-11-21 16:16 +0100
              Re: Euler's constant Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-11-22 00:44 -0800
        Re: Euler's constant Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-11-21 15:33 +0000
          Re: Euler's constant Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-11-21 08:50 -0800
            Re: Euler's constant "BartC" <bc@freeuk.com> - 2011-11-21 17:13 +0000
              Re: Euler's constant James Kuyper <jameskuyper@verizon.net> - 2011-11-21 12:29 -0500
              Re: Euler's constant Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-11-21 09:28 -0800
                Re: Euler's constant Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-11-21 23:07 +0000
            Re: Euler's constant Kaz Kylheku <kaz@kylheku.com> - 2011-11-21 17:29 +0000
              Re: Euler's constant James Kuyper <jameskuyper@verizon.net> - 2011-11-21 12:36 -0500
        Re: Euler's constant Keith Thompson <kst-u@mib.org> - 2011-11-21 13:46 -0800
        Re: Euler's constant "io_x" <a@b.c.invalid> - 2011-11-24 19:08 +0100
          Re: Euler's constant Markus Wichmann <nullplan@gmx.net> - 2011-11-24 20:31 +0100
            Re: Euler's constant "io_x" <a@b.c.invalid> - 2011-11-27 11:24 +0100
              Re: Euler's constant Markus Wichmann <nullplan@gmx.net> - 2011-11-27 12:09 +0100
            Re: Euler's constant "io_x" <a@b.c.invalid> - 2011-11-27 13:33 +0100
      Re: Euler's constant Lew Pitcher <lpitcher@teksavvy.com> - 2011-11-21 10:44 -0800
        Re: Euler's constant Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-11-21 22:53 +0000
          Re: Euler's constant Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-11-21 23:51 +0000
            Re: Euler's constant 88888 Dihedral <dihedral88888@googlemail.com> - 2011-11-22 04:17 -0800
            Re: Euler's constant 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-27 17:50 -0800
              Re: Euler's constant Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-12-28 03:09 +0000
                Re: Euler's constant 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-28 02:52 -0800
                  Re: Euler's constant Seebs <usenet-nospam@seebs.net> - 2011-12-28 18:17 +0000
                  Re: Euler's constant Dr Nick <3-nospam@temporary-address.org.uk> - 2011-12-28 18:49 +0000
                    Re: Euler's constant 88888 Dihedral <dihedral88888@googlemail.com> - 2012-01-04 04:44 -0800
                      Re: Euler's constant Robert Wessel <robertwessel2@yahoo.com> - 2012-01-04 12:33 -0600
        Re: Euler's constant 88888 Dihedral <dihedral88888@googlemail.com> - 2011-11-21 15:07 -0800
          Re: Euler's constant "io_x" <a@b.c.invalid> - 2011-11-24 19:08 +0100
    Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! 88888 Dihedral <dihedral88888@googlemail.com> - 2011-11-21 04:00 -0800
      Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! Kleuskes & Moos <kleuske@somewhere.else.net> - 2011-11-21 12:37 +0000
        Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! 88888 Dihedral <dihedral88888@googlemail.com> - 2011-11-21 04:45 -0800
          Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! Kleuskes & Moos <kleuske@somewhere.else.net> - 2011-11-21 13:35 +0000
        Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-11-22 00:01 +0200
          Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! Kleuskes & Moos <kleuske@somewhere.else.net> - 2011-11-22 11:53 +0000
            Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! Keith Thompson <kst-u@mib.org> - 2011-11-22 13:21 -0800
              Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! Kleuske <kleuske@nowhere.net> - 2011-11-24 14:50 +0000
    Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! "io_x" <a@b.c.invalid> - 2011-11-24 14:08 +0100
      Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! "io_x" <a@b.c.invalid> - 2011-11-24 18:02 +0100
      Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! Lew Pitcher <lpitcher@teksavvy.com> - 2011-11-25 15:31 -0800
        Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! 88888 Dihedral <dihedral88888@googlemail.com> - 2011-11-25 17:40 -0800
          Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! Lew Pitcher <lpitcher@teksavvy.com> - 2011-11-25 22:03 -0800
            Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! 88888 Dihedral <dihedral88888@googlemail.com> - 2011-11-25 22:43 -0800
              Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! Joe Wright <joewwright@comcast.net> - 2011-11-26 02:13 -0500
                Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! 88888 Dihedral <dihedral88888@googlemail.com> - 2011-11-26 19:40 -0800
                  Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! 88888 Dihedral <dihedral88888@googlemail.com> - 2011-11-27 15:35 -0800
              Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! Ian Collins <ian-news@hotmail.com> - 2011-11-26 20:22 +1300
              Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! Lew Pitcher <lpitcher@teksavvy.com> - 2011-11-26 10:55 -0500
              Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! Seebs <usenet-nospam@seebs.net> - 2011-11-28 08:32 +0000
        Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! superpollo <superpollo@tznvy.pbz> - 2011-11-26 12:11 +0100
          Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! Lew Pitcher <lpitcher@teksavvy.com> - 2011-11-26 10:37 -0500
            Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! superpollo <superpollo@tznvy.pbz> - 2011-11-26 21:48 +0100
            Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! Keith Thompson <kst-u@mib.org> - 2011-11-28 01:56 -0800
              Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! Lew Pitcher <lpitcher@teksavvy.com> - 2011-11-28 13:34 -0500
                Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! James Kuyper <jameskuyper@verizon.net> - 2011-11-28 13:45 -0500
                  Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! Lew Pitcher <lpitcher@teksavvy.com> - 2011-11-28 13:50 -0500
                    Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! James Kuyper <jameskuyper@verizon.net> - 2011-11-28 14:32 -0500
                    Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! Kleuske <kleuske@nowhere.net> - 2011-11-28 21:16 +0000
                Re: OK. LETS START REAL PROGRAMMING IN C FOR PROBLEMS!!! Keith Thompson <kst-u@mib.org> - 2011-11-28 14:59 -0800

Page 4 of 5 — ← Prev page 1 2 3 [4] 5  Next page →


#13697

FromKleuskes & Moos <kleuske@somewhere.else.net>
Date2011-11-21 12:37 +0000
Message-ID<jadgmm$61v$1@dont-email.me>
In reply to#13694
On Mon, 21 Nov 2011 04:00:21 -0800, 88888 Dihedral wrote:

> I suggest 2 or 3 new built in types added to C that will certainly beat
> other computer languages.

Such as?

> I don't think after 10 years C is still not evolved.

Me neither. In fact i think it's evolved quite a bit.

-------------------------------------------------------------------------------
 ___________________________________
/ I'm DESPONDENT ... I hope there's \
| something DEEP-FRIED under this   |
\ miniature DOMED STADIUM ...       /
 -----------------------------------
  \
   \
       ___  
     {~._.~}
      ( Y )
     ()~*~()   
     (_)-(_)   
-------------------------------------------------------------------------------

[toc] | [prev] | [next] | [standalone]


#13698

From88888 Dihedral <dihedral88888@googlemail.com>
Date2011-11-21 04:45 -0800
Message-ID<10067087.2863.1321879523983.JavaMail.geo-discussion-forums@prfx4>
In reply to#13697
I suggest  a type of a name like  longreal or what ever  that just can behave like 1L in python, maybe  1LL in C, since 1L was used. 

Figure out  the other two build in types that could enhance C  to beat other languages.

[toc] | [prev] | [next] | [standalone]


#13701

FromKleuskes & Moos <kleuske@somewhere.else.net>
Date2011-11-21 13:35 +0000
Message-ID<jadk35$n92$1@dont-email.me>
In reply to#13698
On Mon, 21 Nov 2011 04:45:23 -0800, 88888 Dihedral wrote:

> I suggest  a type of a name like  longreal or what ever  that just can
> behave like 1L in python, maybe  1LL in C, since 1L was used.

You mean, like a ''double'' (short for double precision float) ?

-------------------------------------------------------------------------------
 ______________________________
< MY income is ALL disposable! >
 ------------------------------
  \
   \
       ___  
     {~._.~}
      ( Y )
     ()~*~()   
     (_)-(_)   
-------------------------------------------------------------------------------

[toc] | [prev] | [next] | [standalone]


#13745

FromPhil Carmody <thefatphil_demunged@yahoo.co.uk>
Date2011-11-22 00:01 +0200
Message-ID<87obw56sou.fsf@bazspaz.fatphil.org>
In reply to#13697
Kleuskes & Moos <kleuske@somewhere.else.net> writes:
> On Mon, 21 Nov 2011 04:00:21 -0800, 88888 Dihedral wrote:
> 
> > I suggest 2 or 3 new built in types added to C that will certainly beat
> > other computer languages.
> 
> Such as?
> 
> > I don't think after 10 years C is still not evolved.
> 
> Me neither. In fact i think it's evolved quite a bit.

It's evolved almost quite far enough, and perhaps too far in some
directions. I think that's one of its beauties, it's still
recognisable as the language I first saw in the 80s.

I was reading about a <ahem> very closely related language recently
and was delighted to see that a feature that was standardized after I
last seriously used the full language, about 10 years ago, is now
deprecated. The "designers", and I use the term very loosely - they're
clearly bodgers who can't think things through thoroughly enough, of
that language should be taken outside and whipped. And their language
derided for the mess that it is.

Oh -  do you not think that a 15-line long .sig is a bit excessive 
attached to a post with only two lines of original text?

Phil
-- 
Unix is simple. It just takes a genius to understand its simplicity
-- Dennis Ritchie (1941-2011), Unix Co-Creator

[toc] | [prev] | [next] | [standalone]


#13780

FromKleuskes & Moos <kleuske@somewhere.else.net>
Date2011-11-22 11:53 +0000
Message-ID<jag2et$mog$2@dont-email.me>
In reply to#13745
On Tue, 22 Nov 2011 00:01:37 +0200, Phil Carmody wrote:

> Kleuskes & Moos <kleuske@somewhere.else.net> writes:
>> On Mon, 21 Nov 2011 04:00:21 -0800, 88888 Dihedral wrote:
>> 
>> > I suggest 2 or 3 new built in types added to C that will certainly
>> > beat other computer languages.
>> 
>> Such as?
>> 
>> > I don't think after 10 years C is still not evolved.
>> 
>> Me neither. In fact i think it's evolved quite a bit.
> 
> It's evolved almost quite far enough, and perhaps too far in some
> directions. I think that's one of its beauties, it's still recognisable
> as the language I first saw in the 80s.
> 
> I was reading about a <ahem> very closely related language recently and
> was delighted to see that a feature that was standardized after I last
> seriously used the full language, about 10 years ago, is now deprecated.
> The "designers", and I use the term very loosely - they're clearly
> bodgers who can't think things through thoroughly enough, of that
> language should be taken outside and whipped. And their language derided
> for the mess that it is.

I think i can guess which language...

> Oh -  do you not think that a 15-line long .sig is a bit excessive
> attached to a post with only two lines of original text?

Provided for your amusement only. The argument of conserving bandwidth
may have been valid 20 years ago, nowadays it's hardly valid.

-------------------------------------------------------------------------------
 ______________________________
< Inside, I'm already SOBBING! >
 ------------------------------
  \
   \
       ___  
     {~._.~}
      ( Y )
     ()~*~()   
     (_)-(_)   
-------------------------------------------------------------------------------

[toc] | [prev] | [next] | [standalone]


#13797

FromKeith Thompson <kst-u@mib.org>
Date2011-11-22 13:21 -0800
Message-ID<ln4nxvvooy.fsf@nuthaus.mib.org>
In reply to#13780
Kleuskes & Moos <kleuske@somewhere.else.net> writes:
> On Tue, 22 Nov 2011 00:01:37 +0200, Phil Carmody wrote:
[...]
>> Oh -  do you not think that a 15-line long .sig is a bit excessive
>> attached to a post with only two lines of original text?
>
> Provided for your amusement only. The argument of conserving bandwidth
> may have been valid 20 years ago, nowadays it's hardly valid.

Bandwidth isn't the only issue.  It takes up space on everyone's screen
that could be used to show more useful information.  (And frankly they
aren't all that amusing.)

At least use a proper signature delimiter (a line consisting of "-- ").

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

[toc] | [prev] | [next] | [standalone]


#13857

FromKleuske <kleuske@nowhere.net>
Date2011-11-24 14:50 +0000
Message-ID<jallj8$9ih$1@dont-email.me>
In reply to#13797
On Tue, 22 Nov 2011 13:21:01 -0800, Keith Thompson saw fit to publish the
following:

> Kleuskes & Moos <kleuske@somewhere.else.net> writes:
>> On Tue, 22 Nov 2011 00:01:37 +0200, Phil Carmody wrote:
> [...]
>>> Oh -  do you not think that a 15-line long .sig is a bit excessive
>>> attached to a post with only two lines of original text?
>>
>> Provided for your amusement only. The argument of conserving bandwidth
>> may have been valid 20 years ago, nowadays it's hardly valid.
> 
> Bandwidth isn't the only issue.  It takes up space on everyone's screen
> that could be used to show more useful information.  (And frankly they
> aren't all that amusing.)
> 
> At least use a proper signature delimiter (a line consisting of "-- ").

Aye, aye. Sir!

-- 
The idea of male and female are universal constants.
		-- Kirk, "Metamorphosis", stardate 3219.8

[toc] | [prev] | [next] | [standalone]


#13853

From"io_x" <a@b.c.invalid>
Date2011-11-24 14:08 +0100
Message-ID<4ece40e9$0$1385$4fafbaef@reader2.news.tin.it>
In reply to#13650
"88888 Dihedral" <dihedral88888@googlemail.com> ha scritto nel messaggio
news:24357587.77.1321816326271.JavaMail.geo-discussion-forums@prnv30...
> PROBLEM 1: COMPUTE THE EULER'S NUMBER UP TO 30 DIGITS AFTER 1.
> THE DIGIT REQUIRED SHOULD BE PARAMETER BY THE CALLER!

yes but i'm a little ot because it is C++...

my sys change the precision of all the floats
and the time is too much [1 or 2 minuts] because if change the precision of
floats
all costants are recalculated for the new precision
(among these there is "e" too)

Something as:
[i don't know if it is right]
#include "dlluse.h"

int  daie(fnum*  z, int  prec)
{fnum  y, k;
 int p, p10;

 if(z==0||prec<0)  R  0;

 set_precision10(prec);
 ooo.precision(prec);

 y=1; k=2; *z=2;
 F(;;){y = y/k;
       if(y==0)  break;
       *z+=y; k+=1;
      }
 R   1;
}

int main27(void)
{fnum   r, z;
 int    g;

 if(daie(&z, 10)==0) {P("Errore");   R  0;}
 else {ooo<<"z= "<< z<<"\n"; }
 if(daie(&z, 50)==0) {P("Errore");   R  0;}
 else {ooo<<"z= "<< z<<"\n"; }
 if(daie(&z, 100)==0) {P("Errore");  R  0;}
 else {ooo<<"z= "<< z<<"\n"; }
 if(daie(&z, 1000)==0) {P("Errore"); R  0;}
 else {ooo<<"z= "<< z<<"\n"; }
 if(daie(&z, 2000)==0) {P("Errore"); R  0;}
 else {ooo<<"z= ";
         // here if not use the below scrivi()
         // print  1000 digits and not 2000
         // i think it is for buffer on ooo
       scrivi(ooo, z, 2000, 2000, 0);
       ooo<<"\n";
      }
 if(daie(&z, 4000)==0) {P("Errore"); R  0;}
 else {ooo<<"z= ";
       scrivi(ooo, z, 4000, 4000, 0);
       ooo<<"\n";
      }
 R 0;
}

int  main(void)
{/* open close the dll call main27*/
}
------------------------------------
z= 2.7182818284
z= 2.71828182845904523536028747135266249775724709369996
z=
2.71828182845904523536028747135266249775724709369995957496696762772407663035354
75945713821785251664274
z=
2.71828182845904523536028747135266249775724709369995957496696762772407663035354
7594571382178525166427427466391932003059921817413596629043572900334295260595630738
1323286279434907632338298807531952510190115738341879307021540891499348841675092447
6146066808226480016847741185374234544243710753907774499206955170276183860626133138
4583000752044933826560297606737113200709328709127443747047230696977209310141692836
8190255151086574637721112523897844250569536967707854499699679468644549059879316368
8923009879312773617821542499922957635148220826989519366803318252886939849646510582
0939239829488793320362509443117301238197068416140397019837679320683282376464804295
3118023287825098194558153017567173613320698112509961818815930416903515988885193458
0727386673858942287922849989208680582574927961048419844436346324496848756023362482
7041978623209002160990235304369941849146314093431738143640546253152096183690888707
0167683964243781405927145635490613031072085103837505101157477041718986106873969655
212671546889570350351
z=
2.71828182845904523536028747135266249775724709369995957496696762772407663035354
7594571382178525166427427466391932003059921817413596629043572900334295260595630738
1323286279434907632338298807531952510190115738341879307021540891499348841675092447
6146066808226480016847741185374234544243710753907774499206955170276183860626133138
4583000752044933826560297606737113200709328709127443747047230696977209310141692836
8190255151086574637721112523897844250569536967707854499699679468644549059879316368
8923009879312773617821542499922957635148220826989519366803318252886939849646510582
0939239829488793320362509443117301238197068416140397019837679320683282376464804295
3118023287825098194558153017567173613320698112509961818815930416903515988885193458
0727386673858942287922849989208680582574927961048419844436346324496848756023362482
7041978623209002160990235304369941849146314093431738143640546253152096183690888707
0167683964243781405927145635490613031072085103837505101157477041718986106873969655
2126715468895703503540212340784981933432106817012100562788023519303322474501585390
4730419957777093503660416997329725088687696640355570716226844716256079882651787134
1951246652010305921236677194325278675398558944896970964097545918569563802363701621
1204774272283648961342251644507818244235294863637214174023889344124796357437026375
5294448337998016125492278509257782562092622648326277933386566481627725164019105900
4916449982893150566047258027786318641551956532442586982946959308019152987211725563
4754639644791014590409058629849679128740687050489585867174798546677575732056812884
5920541334053922000113786300945560688166740016984205580403363795376452030402432256
6135278369511778838638744396625322498506549958862342818997077332761717839280349465
0143455889707194258639877275471096295374152111513683506275260232648472870392076431
0059584116612054529703023647254929666938115137322753645098889031360205724817658511
8063036442812314965507047510254465011727211555194866850800368532281831521960037356
2527944951582841882947876108526398139
z=
2.71828182845904523536028747135266249775724709369995957496696762772407663035354
7594571382178525166427427466391932003059921817413596629043572900334295260595630738
1323286279434907632338298807531952510190115738341879307021540891499348841675092447
6146066808226480016847741185374234544243710753907774499206955170276183860626133138
4583000752044933826560297606737113200709328709127443747047230696977209310141692836
8190255151086574637721112523897844250569536967707854499699679468644549059879316368
8923009879312773617821542499922957635148220826989519366803318252886939849646510582
0939239829488793320362509443117301238197068416140397019837679320683282376464804295
3118023287825098194558153017567173613320698112509961818815930416903515988885193458
0727386673858942287922849989208680582574927961048419844436346324496848756023362482
7041978623209002160990235304369941849146314093431738143640546253152096183690888707
0167683964243781405927145635490613031072085103837505101157477041718986106873969655
2126715468895703503540212340784981933432106817012100562788023519303322474501585390
4730419957777093503660416997329725088687696640355570716226844716256079882651787134
1951246652010305921236677194325278675398558944896970964097545918569563802363701621
1204774272283648961342251644507818244235294863637214174023889344124796357437026375
5294448337998016125492278509257782562092622648326277933386566481627725164019105900
4916449982893150566047258027786318641551956532442586982946959308019152987211725563
4754639644791014590409058629849679128740687050489585867174798546677575732056812884
5920541334053922000113786300945560688166740016984205580403363795376452030402432256
6135278369511778838638744396625322498506549958862342818997077332761717839280349465
0143455889707194258639877275471096295374152111513683506275260232648472870392076431
0059584116612054529703023647254929666938115137322753645098889031360205724817658511
8063036442812314965507047510254465011727211555194866850800368532281831521960037356
2527944951582841882947876108526398139559900673764829224437528718462457803619298197
1399147564488262603903381441823262515097482798777996437308997038886778227138360577
2978824125611907176639465070633045279546618550966661856647097113444740160704626215
6807174818778443714369882185596709591025968620023537185887485696522000503117343920
7321139080329363447972735595527734907178379342163701205005451326383544000186323991
4907054797780566978533580489669062951194324730995876552368128590413832411607226029
9833053537087613893963917795745401613722361878936526053815584158718692553860616477
9834025435128439612946035291332594279490433729908573158029095863138268329147711639
6337092400316894586360606458459251269946557248391865642097526850823075442545993769
1704197778008536273094171016343490769642372229435236612557250881477922315197477806
0569672538017180776360346245927877846585065605078084421152969752189087401966090665
1803516501792504619501366585436632712549639908549144200014574760819302212066024330
0964127048943903971771951806990869986066365832322787093765022601492910115171776359
4460202324930028040186772391028809786660565118326004368850881715723866984224220102
4950551881694803221002515426494639812873677658927688163598312477886520141174110913
6011649950766290779436460058519419985601626479076153210387275571269925182756879893
0276176114616254935649590379804583818232336861201624373656984670378585330527583333
7939907521660692380533698879565137285593883499894707416181550125397064648171946708
3481972144888987906765037959036696724949925452790337296361626589760394985767413973
5944102374432970935547798262961459144293645142861715858733974679189757121195618738
5783644758448423555581050025611492391518893099463428413936080383091662818811503715
2849670597416256282360921680751501777253874025642534708790891372917228286115159156
8372524163077225440633787593105982676094420326192428531701878177296023541306067213
6046000389661093647095141417185777014180606443636815464440053316087783143174440811
949422975599314011888683314832802706553833004693290115744147563139997

were obiovisily P means a printf like function, ooo means a cout like operator,
 F means for, and R return :)

i think c++ streams operator are not good defined for usefullness

> PROBLEM 2: COMPUTE PI AS IN THE ABOVE!
>
> PROBLEM 3: LIST ALL PERMUTATIONS OF A STRING WITHOUT ANY REPEATED STRING IN
> THE LIST!
>
> PROBLEM 4: IMPLEMENT A HASH THAT COULD BE AS FAST AS POSSIBLE AND VERY STABLE
> AND ROBUST TO BE USED EVERYWHERE  TO BEAT OTHER LANGUAGES WITH A HASH BUILT
> IN.






[toc] | [prev] | [next] | [standalone]


#13862

From"io_x" <a@b.c.invalid>
Date2011-11-24 18:02 +0100
Message-ID<4ece77ce$0$1392$4fafbaef@reader1.news.tin.it>
In reply to#13853
"io_x" <a@b.c.invalid> ha scritto nel messaggio
news:4ece40e9$0$1385$4fafbaef@reader2.news.tin.it...
>
> "88888 Dihedral" <dihedral88888@googlemail.com> ha scritto nel messaggio
> news:24357587.77.1321816326271.JavaMail.geo-discussion-forums@prnv30...
>> PROBLEM 1: COMPUTE THE EULER'S NUMBER UP TO 30 DIGITS AFTER 1.
>> THE DIGIT REQUIRED SHOULD BE PARAMETER BY THE CALLER!
>
> yes but i'm a little ot because it is C++...
>
> my sys change the precision of all the floats
> and the time is too much [1 or 2 minuts] because if change the precision of
> floats
> all costants are recalculated for the new precision
> (among these there is "e" too)
>
> Something as:
> [i don't know if it is right]
> #include "dlluse.h"
>
> int  daie(fnum*  z, int  prec)
> {fnum  y, k;
> int p, p10;
>
> if(z==0||prec<0)  R  0;
>
> set_precision10(prec);
> ooo.precision(prec);
>
> y=1; k=2; *z=2;
> F(;;){y = y/k;
>       if(y==0)  break;
>       *z+=y; k+=1;
>      }
> R   1;
> }
>
> int main27(void)
> {fnum   r, z;
> int    g;

there is anhoter problem:
  if here i have
  fnum   x;
  x=10.123123123;

> if(daie(&z, 10)==0) {P("Errore");   R  0;}
> else {ooo<<"z= "<< z<<"\n"; }

 here because change the precision in the float type
 ooo<<x<<"\n";
 will not show 10.123123123 but a different number


[toc] | [prev] | [next] | [standalone]


#13900

FromLew Pitcher <lpitcher@teksavvy.com>
Date2011-11-25 15:31 -0800
Message-ID<459390d2-53c4-49cc-9b97-c25337d9007e@o5g2000yqa.googlegroups.com>
In reply to#13853
On Nov 24, 8:08 am, "io_x" <a...@b.c.invalid> wrote:
> "88888 Dihedral" <dihedral88...@googlemail.com> ha scritto nel messaggionews:24357587.77.1321816326271.JavaMail.geo-discussion-forums@prnv30...
>
> > PROBLEM 1: COMPUTE THE EULER'S NUMBER UP TO 30 DIGITS AFTER 1.
> > THE DIGIT REQUIRED SHOULD BE PARAMETER BY THE CALLER!
>
> yes but i'm a little ot because it is C++...

So, let's try something /on-topic/, then, shall we?

/*
** This program was inspired by the article "The Impossible Dream:
** Computing e to 116,000 places with a Personal Computer" by
** Stephen Wozniak, published in Byte Magazine Vol 6, Issue 6
** (June 1981, pp392).
**
** Essentially, the following program implements a partial expansion
** of the equation: e = 1 + (1/1!) + (1/2!) + (1/3!) + ... + (1/n!)
** by inverting the equation, such that it reads...
** e = (((((...(((((1/n) + 1) / (n-1)) + 1) ... / 3) + 1) / 2) + 1) /
1) + 1
**
** I originally wrote this program in Z80 Assembler code, to run under
** CP/M (Dec 1986), and subsequently have recoded the program in
** 370 Assembler to run under MVS and VSE, and C to run under MSDOS
** and Linux
**
** Lew Pitcher, 1999
*/
#include <stdio.h>

#define	I	1		/* number of bytes in integer portion	*/
#define	X	2078		/* number of bytes in fraction portion	*/
#define	N	1776		/* number of divide iterations		*/
#define	P	5000		/* number of multiply iterations	*/

char e[I+X];			/* holds fixed point binary value of e	*/

int main(void)
{
	void divide(char *, unsigned, unsigned),
	     multiply(char *, unsigned, unsigned);

	unsigned n,		/* divisor for calculation loop		*/
		 p;		/* precision for print loop		*/

	e[0] = 1;		/* start the series at 1.anything	*/
	for (n = N; n > 0; --n)
	{
		divide(e,n,I+X);
		e[0] += 1;
	}

	fputs(" e == ",stdout); fputc(e[0]+'0',stdout); fputc('.',stdout);
	for (p = 0; p < P; ++p)
	{
		e[0] = 0;
		multiply(e,10,I+X);
		fputc(e[0]+'0',stdout);
		if (p%5 == 4)
			if (p%50 == 49)
				fputs("\n\t",stdout);
			else
				fputc(' ',stdout);
	}
	fputc('\n',stdout);

	return 0;
}

void divide(char *dvd, unsigned dvr, unsigned prc)
{
	char *Wk_q;
	unsigned bit, rmdr;

	rmdr = 0;
	for (Wk_q = dvd; Wk_q < dvd+prc; ++Wk_q)
	{
		for(bit = 0; bit < 8; ++bit)
		{
			rmdr *= 2;
			if (*Wk_q & 0200) rmdr += 1;
			*Wk_q <<= 1;
			if (rmdr >= dvr)
			{
				*Wk_q += 1;
				rmdr -= dvr;
			}
		}
	}
}

void multiply(char *mcd, unsigned mpy, unsigned prc)
{
	char *Wk_r;
	unsigned bit, ovflo;

	ovflo = 0;
	for (Wk_r = mcd+prc-1; Wk_r >= mcd; --Wk_r)
	{
		for (bit = 8; bit > 0; --bit)
		{
			if (*Wk_r & 1) ovflo += mpy;
			*Wk_r >>= 1; *Wk_r &= 0177;
			if (ovflo & 1) *Wk_r = *Wk_r | 0200;
			ovflo /= 2;
		}
	}
}

=========================== output ============================
 e == 2.71828 18284 59045 23536 02874 71352 66249 77572 47093 69995
        95749 66967 62772 40766 30353 54759 45713 82178 52516 64274
        27466 39193 20030 59921 81741 35966 29043 57290 03342 95260
        59563 07381 32328 62794 34907 63233 82988 07531 95251 01901
        15738 34187 93070 21540 89149 93488 41675 09244 76146 06680
        82264 80016 84774 11853 74234 54424 37107 53907 77449 92069
        55170 27618 38606 26133 13845 83000 75204 49338 26560 29760
        67371 13200 70932 87091 27443 74704 72306 96977 20931 01416
        92836 81902 55151 08657 46377 21112 52389 78442 50569 53696
        77078 54499 69967 94686 44549 05987 93163 68892 30098 79312
        77361 78215 42499 92295 76351 48220 82698 95193 66803 31825
        28869 39849 64651 05820 93923 98294 88793 32036 25094 43117
        30123 81970 68416 14039 70198 37679 32068 32823 76464 80429
        53118 02328 78250 98194 55815 30175 67173 61332 06981 12509
        96181 88159 30416 90351 59888 85193 45807 27386 67385 89422
        87922 84998 92086 80582 57492 79610 48419 84443 63463 24496
        84875 60233 62482 70419 78623 20900 21609 90235 30436 99418
        49146 31409 34317 38143 64054 62531 52096 18369 08887 07016
        76839 64243 78140 59271 45635 49061 30310 72085 10383 75051
        01157 47704 17189 86106 87396 96552 12671 54688 95703 50354
        02123 40784 98193 34321 06817 01210 05627 88023 51930 33224
        74501 58539 04730 41995 77770 93503 66041 69973 29725 08868
        76966 40355 57071 62268 44716 25607 98826 51787 13419 51246
        65201 03059 21236 67719 43252 78675 39855 89448 96970 96409
        75459 18569 56380 23637 01621 12047 74272 28364 89613 42251
        64450 78182 44235 29486 36372 14174 02388 93441 24796 35743
        70263 75529 44483 37998 01612 54922 78509 25778 25620 92622
        64832 62779 33386 56648 16277 25164 01910 59004 91644 99828
        93150 56604 72580 27786 31864 15519 56532 44258 69829 46959
        30801 91529 87211 72556 34754 63964 47910 14590 40905 86298
        49679 12874 06870 50489 58586 71747 98546 67757 57320 56812
        88459 20541 33405 39220 00113 78630 09455 60688 16674 00169
        84205 58040 33637 95376 45203 04024 32256 61352 78369 51177
        88386 38744 39662 53224 98506 54995 88623 42818 99707 73327
        61717 83928 03494 65014 34558 89707 19425 86398 77275 47109
        62953 74152 11151 36835 06275 26023 26484 72870 39207 64310
        05958 41166 12054 52970 30236 47254 92966 69381 15137 32275
        36450 98889 03136 02057 24817 65851 18063 03644 28123 14965
        50704 75102 54465 01172 72115 55194 86685 08003 68532 28183
        15219 60037 35625 27944 95158 28418 82947 87610 85263 98139
        55990 06737 64829 22443 75287 18462 45780 36192 98197 13991
        47564 48826 26039 03381 44182 32625 15097 48279 87779 96437
        30899 70388 86778 22713 83605 77297 88241 25611 90717 66394
        65070 63304 52795 46618 55096 66618 56647 09711 34447 40160
        70462 62156 80717 48187 78443 71436 98821 85596 70959 10259
        68620 02353 71858 87485 69652 20005 03117 34392 07321 13908
        03293 63447 97273 55955 27734 90717 83793 42163 70120 50054
        51326 38354 40001 86323 99149 07054 79778 05669 78533 58048
        96690 62951 19432 47309 95876 55236 81285 90413 83241 16072
        26029 98330 53537 08761 38939 63917 79574 54016 13722 36187
        89365 26053 81558 41587 18692 55386 06164 77983 40254 35128
        43961 29460 35291 33259 42794 90433 72990 85731 58029 09586
        31382 68329 14771 16396 33709 24003 16894 58636 06064 58459
        25126 99465 57248 39186 56420 97526 85082 30754 42545 99376
        91704 19777 80085 36273 09417 10163 43490 76964 23722 29435
        23661 25572 50881 47792 23151 97477 80605 69672 53801 71807
        76360 34624 59278 77846 58506 56050 78084 42115 29697 52189
        08740 19660 90665 18035 16501 79250 46195 01366 58543 66327
        12549 63990 85491 44200 01457 47608 19302 21206 60243 30096
        41270 48943 90397 17719 51806 99086 99860 66365 83232 27870
        93765 02260 14929 10115 17177 63594 46020 23249 30028 04018
        67723 91028 80978 66605 65118 32600 43688 50881 71572 38669
        84224 22010 24950 55188 16948 03221 00251 54264 94639 81287
        36776 58927 68816 35983 12477 88652 01411 74110 91360 11649
        95076 62907 79436 46005 85194 19985 60162 64790 76153 21038
        72755 71269 92518 27568 79893 02761 76114 61625 49356 49590
        37980 45838 18232 33686 12016 24373 65698 46703 78585 33052
        75833 33793 99075 21660 69238 05336 98879 56513 72855 93883
        49989 47074 16181 55012 53970 64648 17194 67083 48197 21448
        88987 90676 50379 59036 69672 49499 25452 79033 72963 61626
        58976 03949 85767 41397 35944 10237 44329 70935 54779 82629
        61459 14429 36451 42861 71585 87339 74679 18975 71211 95618
        73857 83644 75844 84235 55581 05002 56114 92391 51889 30994
        63428 41393 60803 83091 66281 88115 03715 28496 70597 41625
        62823 60921 68075 15017 77253 87402 56425 34708 79089 13729
        17228 28611 51591 56837 25241 63077 22544 06337 87593 10598
        26760 94420 32619 24285 31701 87817 72960 23541 30606 72136
        04600 03896 61093 64709 51414 17185 77701 41806 06443 63681
        54644 40053 31608 77831 43174 44081 19494 22975 59931 40118
        88683 31483 28027 06553 83300 46932 90115 74414 75631 39997
        22170 38046 17092 89457 90962 71662 26074 07187 49975 35921
        27560 84414 73782 33032 70330 16823 71936 48002 17328 57349
        35947 56433 41299 43024 85023 57322 14597 84328 26414 21684
        87872 16733 67010 61509 42434 56984 40187 33128 10107 94512
        72237 37886 12605 81656 68053 71439 61278 88732 52737 38903
        92890 50686 53241 38062 79602 59303 87727 69778 37928 68409
        32536 58807 33988 45721 87460 21005 31148 33513 23850 04782
        71693 76218 00490 47955 97959 29059 16554 70505 77751 43081
        75112 69898 51884 08718 56402 60353 05583 73783 24229 24185
        62564 42550 22672 15598 02740 12617 97192 80471 39600 68916
        38286 65277 00975 27670 69777 03643 92602 24372 84184 08832
        51848 77047 26384 40379 53016 69054 65937 46161 93238 40363
        89313 13643 27137 68884 10268 11219 89127 52230 56256 75625
        47017 25086 34976 53672 88605 96675 27408 68627 40791 28565
        76996 31378 97530 34660 61666 98042 18267 72456 05306 60773
        89962 42183 40859 88207 18646 82623 21508 02882 86359 74683
        96543 58856 68550 37731 31296 58797 58105 01214 91620 76567
        69950 65971 53447 63470 32085 32156 03674 82860 83786 56803
        07306 26576 33469 77429 56346 43716 70939 71930 60876 96349
        53288 46833 61303 88294 31040 80029 68738 69117 06666 61468

[toc] | [prev] | [next] | [standalone]


#13903

From88888 Dihedral <dihedral88888@googlemail.com>
Date2011-11-25 17:40 -0800
Message-ID<14304310.720.1322271627269.JavaMail.geo-discussion-forums@pret21>
In reply to#13900
On Saturday, November 26, 2011 7:31:46 AM UTC+8, Lew Pitcher wrote:
> On Nov 24, 8:08 am, "io_x" <a...@b.c.invalid> wrote:
> > "88888 Dihedral" <dihedr...@googlemail.com> ha scritto nel messaggionews:24357587.77.1321816326271.JavaMail.geo-discussion-forums@prnv30...
> >
> > > PROBLEM 1: COMPUTE THE EULER'S NUMBER UP TO 30 DIGITS AFTER 1.
> > > THE DIGIT REQUIRED SHOULD BE PARAMETER BY THE CALLER!
> >
> > yes but i'm a little ot because it is C++...
> 
> So, let's try something /on-topic/, then, shall we?
> 
> /*
> ** This program was inspired by the article "The Impossible Dream:
> ** Computing e to 116,000 places with a Personal Computer" by
> ** Stephen Wozniak, published in Byte Magazine Vol 6, Issue 6
> ** (June 1981, pp392).
> **
> ** Essentially, the following program implements a partial expansion
> ** of the equation: e = 1 + (1/1!) + (1/2!) + (1/3!) + ... + (1/n!)
> ** by inverting the equation, such that it reads...
> ** e = (((((...(((((1/n) + 1) / (n-1)) + 1) ... / 3) + 1) / 2) + 1) /
> 1) + 1
> **
> ** I originally wrote this program in Z80 Assembler code, to run under
> ** CP/M (Dec 1986), and subsequently have recoded the program in
> ** 370 Assembler to run under MVS and VSE, and C to run under MSDOS
> ** and Linux
> **
> ** Lew Pitcher, 1999
> */
> #include <stdio.h>
> 
> #define	I	1		/* number of bytes in integer portion	*/
> #define	X	2078		/* number of bytes in fraction portion	*/
> #define	N	1776		/* number of divide iterations		*/
> #define	P	5000		/* number of multiply iterations	*/
> 
> char e[I+X];			/* holds fixed point binary value of e	*/
> 
> int main(void)
> {
> 	void divide(char *, unsigned, unsigned),
> 	     multiply(char *, unsigned, unsigned);
> 
> 	unsigned n,		/* divisor for calculation loop		*/
> 		 p;		/* precision for print loop		*/
> 
> 	e[0] = 1;		/* start the series at 1.anything	*/
> 	for (n = N; n > 0; --n)
> 	{
> 		divide(e,n,I+X);
> 		e[0] += 1;
> 	}
> 
> 	fputs(" e == ",stdout); fputc(e[0]+'0',stdout); fputc('.',stdout);
> 	for (p = 0; p < P; ++p)
> 	{
> 		e[0] = 0;
> 		multiply(e,10,I+X);
> 		fputc(e[0]+'0',stdout);
> 		if (p%5 == 4)
> 			if (p%50 == 49)
> 				fputs("\n\t",stdout);
> 			else
> 				fputc(' ',stdout);
> 	}
> 	fputc('\n',stdout);
> 
> 	return 0;
> }
> 
> void divide(char *dvd, unsigned dvr, unsigned prc)
> {
> 	char *Wk_q;
> 	unsigned bit, rmdr;
> 
> 	rmdr = 0;
> 	for (Wk_q = dvd; Wk_q < dvd+prc; ++Wk_q)
> 	{
> 		for(bit = 0; bit < 8; ++bit)
> 		{
> 			rmdr *= 2;
> 			if (*Wk_q & 0200) rmdr += 1;
> 			*Wk_q <<= 1;
> 			if (rmdr >= dvr)
> 			{
> 				*Wk_q += 1;
> 				rmdr -= dvr;
> 			}
> 		}
> 	}
> }
> 

A division of a long integer with a known length of bytes by an integer of 8 to 1bits  in a digit by digit  division which that every digit is at least 8 bits  is still missing. 

This is trivial in C, but I'll see if we have  to start a c programming race here.

[toc] | [prev] | [next] | [standalone]


#13906

FromLew Pitcher <lpitcher@teksavvy.com>
Date2011-11-25 22:03 -0800
Message-ID<77639a05-64f7-41c8-bb3a-c7f3194f16db@v8g2000yqk.googlegroups.com>
In reply to#13903
On Nov 25, 8:40 pm, 88888 Dihedral <dihedral88...@googlemail.com>
wrote:

> A division of a long integer with a known length of bytes by an integer of 8 to
> 1bits  in a digit by digit  division which that every digit is at least 8 bits  is
> still missing.
>
> This is trivial in C, but I'll see if we have  to start a c programming race here.

Since I haven't seen one line of /your/ C code, I suggest that you
tackle this "trivial" problem yourself. I'm looking forward to your
solution.

[toc] | [prev] | [next] | [standalone]


#13907

From88888 Dihedral <dihedral88888@googlemail.com>
Date2011-11-25 22:43 -0800
Message-ID<19347638.434.1322289811366.JavaMail.geo-discussion-forums@prmr38>
In reply to#13906
I know that a division in C in some compiler in most CPUs is really slow. I write that in assembly.

[toc] | [prev] | [next] | [standalone]


#13908

FromJoe Wright <joewwright@comcast.net>
Date2011-11-26 02:13 -0500
Message-ID<kPydnZ1pJ8wJDE3TnZ2dnUVZ_rSdnZ2d@giganews.com>
In reply to#13907
On 11/26/2011 01:43, 88888 Dihedral wrote:
> I know that a division in C in some compiler in most CPUs is really slow. I write that in assembly.

Do you? Would you tell me what you know about division that the compiler 
writer doesn't know?

-- 
Joe Wright
"If you rob Peter to pay Paul you can depend on the support of Paul."

[toc] | [prev] | [next] | [standalone]


#13953

From88888 Dihedral <dihedral88888@googlemail.com>
Date2011-11-26 19:40 -0800
Message-ID<29635857.168.1322365237185.JavaMail.geo-discussion-forums@prnh1>
In reply to#13908
On Saturday, November 26, 2011 3:13:26 PM UTC+8, Joe Wright wrote:
> On 11/26/2011 01:43, 88888 Dihedral wrote:
> > I know that a division in C in some compiler in most CPUs is really slow. I write that in assembly.
> 
> Do you? Would you tell me what you know about division that the compiler 
> writer doesn't know?
> 
> -- 
> Joe Wright
> "If you rob Peter to pay Paul you can depend on the support of Paul."

I contribute a c function to divide a pointer to an unsigned char array with a known length that produces a remainder of the long real number.

int longreal_divide_mod5( char *longnum, int length)
{
int i;
unsinged long remainder; // 32 or 64 bits, I'll show the 32 bit version
tmp=0;

for( i=0, remainder=0;i<length;i++) 
  remainder+=longnum[i]; // mod 255 done in the first pass

// assume remainder won't over flow
tmp+= (remainder>>24); //top 8 bits
tmp+= ((remainder)<<8)>>24 ; // another 8 bits
tmp+= ((remainder)<<16)>>24 ; // another 8 bits
tmp+= remainder & 0xff;// final 8 bits
//4 *255<=1020 in 10 bits

while (i=tmp&512) if i { tmp^=512; tmp++};
while (i=tmp&256) if i { tmp^=256; tmp++};
// tmp in a byte now
return tmp%5; //there is another way to avoid the mod
}



 
 
 






[toc] | [prev] | [next] | [standalone]


#13986

From88888 Dihedral <dihedral88888@googlemail.com>
Date2011-11-27 15:35 -0800
Message-ID<2343833.16.1322436943945.JavaMail.geo-discussion-forums@prls3>
In reply to#13953
On Sunday, November 27, 2011 11:40:37 AM UTC+8, 88888 Dihedral wrote:
> On Saturday, November 26, 2011 3:13:26 PM UTC+8, Joe Wright wrote:
> > On 11/26/2011 01:43, 88888 Dihedral wrote:
> > > I know that a division in C in some compiler in most CPUs is really slow. I write that in assembly.
> > 
> > Do you? Would you tell me what you know about division that the compiler 
> > writer doesn't know?
> > 
> > -- 
> > Joe Wright
> > "If you rob Peter to pay Paul you can depend on the support of Paul."
> 
> I contribute a c function to divide a pointer to an unsigned char array with a known length that produces a remainder of the long real number.
> 
> int longreal_divide_mod5( char *longnum, int length)
> {
> int i;
> unsinged long remainder; // 32 or 64 bits, I'll show the 32 bit version
> tmp=0;
> 
> for( i=0, remainder=0;i<length;i++) 
>   remainder+=longnum[i]; // mod 255 done in the first pass
> 
> /*/ assume remainder won't over flow
> tmp+= (remainder>>24); //top 8 bits
> tmp+= ((remainder)<<8)>>24 ; // another 8 bits
> tmp+= ((remainder)<<16)>>24 ; // another 8 bits
> tmp+= remainder & 0xff;// final 8 bits
> //4 *255<=1020 in 10 bits
> 
> while (i=tmp&512) if i { tmp^=512; tmp++};
> while (i=tmp&256) if i { tmp^=256; tmp++};
> // tmp in a byte now */
> return tmp%5; //there is another way to avoid the mod
> }

I think it is trivial  to have a mod10 by using the above. 

[toc] | [prev] | [next] | [standalone]


#13912

FromIan Collins <ian-news@hotmail.com>
Date2011-11-26 20:22 +1300
Message-ID<9jbid3F4d0U12@mid.individual.net>
In reply to#13907
On 11/26/11 07:43 PM, 88888 Dihedral wrote:

If you are going to post to Usenet, for goodness sake quote the context 
you are relying to!

> I know that a division in C in some compiler in most CPUs is really slow. I write that in assembly.

Examples and evidence please.

-- 
Ian Collins

[toc] | [prev] | [next] | [standalone]


#13922

FromLew Pitcher <lpitcher@teksavvy.com>
Date2011-11-26 10:55 -0500
Message-ID<SZ7Aq.714$r52.623@newsfe03.iad>
In reply to#13907
On November 26, 2011 01:43, in comp.lang.c, dihedral88888@googlemail.com
wrote:

> I know that a division in C in some compiler in most CPUs is really slow.
> I write that in assembly.

Chicken.

-- 
Lew Pitcher
Master Codewright & JOAT-in-training   | Registered Linux User #112576
Me: http://pitcher.digitalfreehold.ca/ | Just Linux: http://justlinux.ca/
----------      Slackware - Because I know what I'm doing.         ------

[toc] | [prev] | [next] | [standalone]


#14003

FromSeebs <usenet-nospam@seebs.net>
Date2011-11-28 08:32 +0000
Message-ID<slrnjd6gss.ors.usenet-nospam@guild.seebs.net>
In reply to#13907
On 2011-11-26, 88888 Dihedral <dihedral88888@googlemail.com> wrote:
> I know that a division in C in some compiler in most CPUs is really slow. I write that in assembly.

Okay, I wasn't previously convinced that you were trolling, but now I am
convinced that you are.

This is stupid.  Since some people reading won't immediately see why it's
stupid:

One possible interpretation is that you are writing a plain old division
instruction in assembly.  This would be stupid, since it's exactly the same
instruction C would be executing.  Furthermore, the concept of "most CPUs"
is thrown out the window the moment you start talking about assembly.
Finally, what specific CPUs are you thinking have slow division?  Division
stopped being painfully slow a decade or two back.

Another is that you are hand-coding an operation as a series of steps.  This
would be stupider than hand-coding a single divide operation.

You don't "know" this.  You may believe it, but you're either a troll or
spectacularly stupid.  And I do mean stupid, not ignorant.  It's fine to not
know anything about how stuff works; most people don't know that.  What's
stupid is pretending you know stuff when you don't.

-s
-- 
Copyright 2011, all wrongs reversed.  Peter Seebach / usenet-nospam@seebs.net
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
I am not speaking for my employer, although they do rent some of my opinions.

[toc] | [prev] | [next] | [standalone]


#13916

Fromsuperpollo <superpollo@tznvy.pbz>
Date2011-11-26 12:11 +0100
Message-ID<4ed0c94d$0$1387$4fafbaef@reader2.news.tin.it>
In reply to#13900
Lew Pitcher ha scritto:
> On Nov 24, 8:08 am, "io_x" <a...@b.c.invalid> wrote:
>> "88888 Dihedral" <dihedral88...@googlemail.com> ha scritto nel messaggionews:24357587.77.1321816326271.JavaMail.geo-discussion-forums@prnv30...
>>
>>> PROBLEM 1: COMPUTE THE EULER'S NUMBER UP TO 30 DIGITS AFTER 1.
>>> THE DIGIT REQUIRED SHOULD BE PARAMETER BY THE CALLER!
>> yes but i'm a little ot because it is C++...
> 
> So, let's try something /on-topic/, then, shall we?
> 
> /*
> ** This program was inspired by the article "The Impossible Dream:
> ** Computing e to 116,000 places with a Personal Computer" by
> ** Stephen Wozniak, published in Byte Magazine Vol 6, Issue 6
> ** (June 1981, pp392).
> **
> ** Essentially, the following program implements a partial expansion
> ** of the equation: e = 1 + (1/1!) + (1/2!) + (1/3!) + ... + (1/n!)
> ** by inverting the equation, such that it reads...
> ** e = (((((...(((((1/n) + 1) / (n-1)) + 1) ... / 3) + 1) / 2) + 1) /
> 1) + 1
> **
> ** I originally wrote this program in Z80 Assembler code, to run under
> ** CP/M (Dec 1986), and subsequently have recoded the program in
> ** 370 Assembler to run under MVS and VSE, and C to run under MSDOS
> ** and Linux
> **
> ** Lew Pitcher, 1999
> */
> #include <stdio.h>
> 
> #define	I	1		/* number of bytes in integer portion	*/
> #define	X	2078		/* number of bytes in fraction portion	*/
> #define	N	1776		/* number of divide iterations		*/
> #define	P	5000		/* number of multiply iterations	*/
> 
> char e[I+X];			/* holds fixed point binary value of e	*/
> 
> int main(void)
> {
> 	void divide(char *, unsigned, unsigned),
> 	     multiply(char *, unsigned, unsigned);
> 
> 	unsigned n,		/* divisor for calculation loop		*/
> 		 p;		/* precision for print loop		*/
> 
> 	e[0] = 1;		/* start the series at 1.anything	*/
> 	for (n = N; n > 0; --n)
> 	{
> 		divide(e,n,I+X);
> 		e[0] += 1;
> 	}
> 
> 	fputs(" e == ",stdout); fputc(e[0]+'0',stdout); fputc('.',stdout);
> 	for (p = 0; p < P; ++p)
> 	{
> 		e[0] = 0;
> 		multiply(e,10,I+X);
> 		fputc(e[0]+'0',stdout);
> 		if (p%5 == 4)
> 			if (p%50 == 49)


here my compiler says:

temp.c: In function ‘main’:
temp.c:50: warning: suggest explicit braces to avoid ambiguous ‘else’


> 				fputs("\n\t",stdout);
> 			else
> 				fputc(' ',stdout);
> 	}
> 	fputc('\n',stdout);
> 
> 	return 0;
> }
> 
> void divide(char *dvd, unsigned dvr, unsigned prc)
> {
> 	char *Wk_q;
> 	unsigned bit, rmdr;
> 
> 	rmdr = 0;
> 	for (Wk_q = dvd; Wk_q < dvd+prc; ++Wk_q)
> 	{
> 		for(bit = 0; bit < 8; ++bit)
> 		{
> 			rmdr *= 2;
> 			if (*Wk_q & 0200) rmdr += 1;
> 			*Wk_q <<= 1;
> 			if (rmdr >= dvr)
> 			{
> 				*Wk_q += 1;
> 				rmdr -= dvr;
> 			}
> 		}
> 	}
> }
> 
> void multiply(char *mcd, unsigned mpy, unsigned prc)
> {
> 	char *Wk_r;
> 	unsigned bit, ovflo;
> 
> 	ovflo = 0;
> 	for (Wk_r = mcd+prc-1; Wk_r >= mcd; --Wk_r)
> 	{
> 		for (bit = 8; bit > 0; --bit)
> 		{
> 			if (*Wk_r & 1) ovflo += mpy;
> 			*Wk_r >>= 1; *Wk_r &= 0177;
> 			if (ovflo & 1) *Wk_r = *Wk_r | 0200;
> 			ovflo /= 2;
> 		}
> 	}
> }


bye

-- 
WAR IS PEACE
FREEDOM IS SLAVERY
IGNORANCE IS STRENGTH

[toc] | [prev] | [next] | [standalone]


Page 4 of 5 — ← Prev page 1 2 3 [4] 5  Next page →

Back to top | Article view | comp.lang.c


csiph-web