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 2 of 5 — ← Prev page 1 [2] 3 4 5  Next page →


#13772

FromNick Keighley <nick_keighley_nospam@hotmail.com>
Date2011-11-22 00:39 -0800
Message-ID<a5d33fff-5cd4-460b-8340-76703c6c5fa7@n14g2000vbn.googlegroups.com>
In reply to#13671
On Nov 21, 3:35 am, Keith Thompson <ks...@mib.org> wrote:
> 88888 Dihedral <dihedral88...@googlemail.com> writes:

> > There was some library for big numbers written C. Of course, printing
> > the big numbers won't be the same as printing native types. With other
> > languages supporting big numbers C with some libraries seems not
> > attractive to novices.
>
> If you're actually interested in particating here, then please
> (a) format your text in lines shorter than 80 columns, preferably
> around 72 and (b) quote some context from the article to which you're
> replying (see 99% of the followups here for examples; Google Groups
> can make this difficult, but the "old" interface isn't as bad as
> the new one).

in what way does google groups make proper quoting difficult?

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


#13796

FromKeith Thompson <kst-u@mib.org>
Date2011-11-22 13:18 -0800
Message-ID<ln8vn7vost.fsf@nuthaus.mib.org>
In reply to#13772
Nick Keighley <nick_keighley_nospam@hotmail.com> writes:
> On Nov 21, 3:35 am, Keith Thompson <ks...@mib.org> wrote:
>> 88888 Dihedral <dihedral88...@googlemail.com> writes:
>
>> > There was some library for big numbers written C. Of course, printing
>> > the big numbers won't be the same as printing native types. With other
>> > languages supporting big numbers C with some libraries seems not
>> > attractive to novices.
>>
>> If you're actually interested in particating here, then please
>> (a) format your text in lines shorter than 80 columns, preferably
>> around 72 and (b) quote some context from the article to which you're
>> replying (see 99% of the followups here for examples; Google Groups
>> can make this difficult, but the "old" interface isn't as bad as
>> the new one).
>
> in what way does google groups make proper quoting difficult?

They've introduced a new user interface that's much worse than the
older one, at least for purposes of posting to Usenet.  I don't
remember the exact details.  Last time I checked, you don't get the
new interface unless you request it, and you can still go back to
the old one.

-- 
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]


#13850

FromNick Keighley <nick_keighley_nospam@hotmail.com>
Date2011-11-24 01:50 -0800
Message-ID<1ae15a1b-c15f-44a5-9b06-823d69cd2792@o9g2000vbc.googlegroups.com>
In reply to#13796
On Nov 22, 9:18 pm, Keith Thompson <ks...@mib.org> wrote:
> Nick Keighley <nick_keighley_nos...@hotmail.com> writes:
> > On Nov 21, 3:35 am, Keith Thompson <ks...@mib.org> wrote:
> >> 88888 Dihedral <dihedral88...@googlemail.com> writes:
>
> >> > There was some library for big numbers written C. Of course, printing
> >> > the big numbers won't be the same as printing native types. With other
> >> > languages supporting big numbers C with some libraries seems not
> >> > attractive to novices.
>
> >> If you're actually interested in particating here, then please
> >> (a) format your text in lines shorter than 80 columns, preferably
> >> around 72 and (b) quote some context from the article to which you're
> >> replying (see 99% of the followups here for examples; Google Groups
> >> can make this difficult, but the "old" interface isn't as bad as
> >> the new one).
>
> > in what way does google groups make proper quoting difficult?
>
> They've introduced a new user interface that's much worse than the
> older one, at least for purposes of posting to Usenet.  I don't
> remember the exact details.  Last time I checked, you don't get the
> new interface unless you request it, and you can still go back to
> the old one.

ah. I think I looked at it, failed to find anything compelling and
stayed with the old interface.

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


#13693 — Re: Euler's constant

Fromjacob navia <jacob@spamsink.net>
Date2011-11-21 12:45 +0100
SubjectRe: Euler's constant
Message-ID<jaddl0$eb6$1@speranza.aioe.org>
In reply to#13650
Le 20/11/11 20:12, 88888 Dihedral a écrit :
> PROBLEM 1: COMPUTE THE EULER'S NUMBER UP TO 30 DIGITS AFTER 1.
> THE DIGIT REQUIRED SHOULD BE PARAMETER BY THE CALLER!

Euler's constant is the limit of the sum when N goes to infinity of:

1 + 1/2 + 1/3 + 1/4 + ... 1/N - ln(n)

This is related to the PSI function (digamma) by

Euler constant = -psi(1)

This can be calculated in C with this program:
(Using lcc-win. Other compilers will be able to do this too
  but in a different way)

d:\lcc\mc79\test>type teuler.c
#include <qfloat.h>
#include <specialfns.h>
#include <stdio.h>
int main(void)
{
         qfloat e=psiq(1.0q);
         printf("Euler constant is:\n%.95qf\n",-e);
}

OUTPUT:
Euler constant is:
+0.577215664901532860606512090082402431042159335939923598805767234884867726777664670936947063291747

Thanks to this poster I have uncovered a bug  in that function, that I 
could correct.

lcc-win uses the Cephes Mathematical library of Stephen L Moshier. He uses:

  *
  *              d     +-
  *   psi(x)  =  -- ln | (x)
  *              dx
  *
  * is the logarithmic derivative of the gamma function.
  * For general positive x, the argument is made greater than 16
  * using the recurrence  psi(x+1) = psi(x) + 1/x.
  * Then the following asymptotic expansion is applied:
  *
  *                           inf.   B
  *                            -      2k
  * psi(x) = log(x) - 1/2x -   >   -------
  *                            -        2k
  *                           k=1   2k x
  *
  * where the B2k are Bernoulli numbers.
  *
  * psi(-x)  =  psi(x+1) + pi/tan(pi(x+1))

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


#13699 — Re: Euler's constant

FromVincenzo Mercuri <vincenzo.mercuri@yahoo.it>
Date2011-11-21 13:54 +0100
SubjectRe: Euler's constant
Message-ID<Kuedne3aqptu1FfTnZ2dnUVZ7sednZ2d@giganews.com>
In reply to#13693
jacob navia ha scritto:
> Le 20/11/11 20:12, 88888 Dihedral a écrit :
>> PROBLEM 1: COMPUTE THE EULER'S NUMBER UP TO 30 DIGITS AFTER 1.
>> THE DIGIT REQUIRED SHOULD BE PARAMETER BY THE CALLER!
>
> Euler's constant is the limit of the sum when N goes to infinity of:
>
...
> This can be calculated in C with this program:
> (Using lcc-win. Other compilers will be able to do this too
> but in a different way)
>
...
> lcc-win uses the Cephes Mathematical library of Stephen L Moshier. He uses:
>
> *
> * d +-
> * psi(x) = -- ln | (x)
> * dx
...

Euler's *constant* and Euler's *number* are actually different
in meaning. While the former usually refers to "gamma", also
known as Euler-Mascheroni constant, the latter is just "e",
also known as Napier's constant (or number). If the OP was
really asking something worth replying, he most likely meant
to ask for an algorithm to compute the Napier's constant.
But let's say that he meant "gamma". Well, a library which
already provides that number is not really what we would have
answered here. There are many math-libraries around the net.
It's cool that lcc already provides one, but nobody could ever
verify the implemented algorithm since lcc is not open-source.

-- 
Vincenzo Mercuri | www.backbox.org

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


#13703 — Re: Euler's constant

Fromjacob navia <jacob@spamsink.net>
Date2011-11-21 14:48 +0100
SubjectRe: Euler's constant
Message-ID<jadkrj$1i5$1@speranza.aioe.org>
In reply to#13699
Le 21/11/11 13:54, Vincenzo Mercuri a écrit :
> Euler's *constant* and Euler's *number* are actually different
> in meaning. While the former usually refers to "gamma", also
> known as Euler-Mascheroni constant, the latter is just "e",
> also known as Napier's constant (or number). If the OP was
> really asking something worth replying, he most likely meant
> to ask for an algorithm to compute the Napier's constant.
> But let's say that he meant "gamma". Well, a library which
> already provides that number is not really what we would have
> answered here. There are many math-libraries around the net.
> It's cool that lcc already provides one, but nobody could ever
> verify the implemented algorithm since lcc is not open-source.
>

Using your logic, you can't use Mathlab then, or Mathematica,
or MSVC, or Maple.

None of those programs are open source.

I explained the algorithm and the library that lcc-win uses.
The Cephes mathematical library is available in source form

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


#13722 — Re: Euler's constant

FromVincenzo Mercuri <vincenzo.mercuri@yahoo.it>
Date2011-11-21 18:58 +0100
SubjectRe: Euler's constant
Message-ID<lq-dndgm89vIDFfTnZ2dnUVZ8r6dnZ2d@giganews.com>
In reply to#13703
jacob navia ha scritto:
> Le 21/11/11 13:54, Vincenzo Mercuri a écrit :
>> Euler's *constant* and Euler's *number* are actually different
>> in meaning. While the former usually refers to "gamma", also
>> known as Euler-Mascheroni constant, the latter is just "e",
>> also known as Napier's constant (or number). If the OP was
>> really asking something worth replying, he most likely meant
>> to ask for an algorithm to compute the Napier's constant.
>> But let's say that he meant "gamma". Well, a library which
>> already provides that number is not really what we would have
>> answered here. There are many math-libraries around the net.
>> It's cool that lcc already provides one, but nobody could ever
>> verify the implemented algorithm since lcc is not open-source.
>>
>
> Using your logic, you can't use Mathlab then, or Mathematica,
> or MSVC, or Maple.
>
> None of those programs are open source.
>
> I explained the algorithm and the library that lcc-win uses.
> The Cephes mathematical library is available in source form
>

No, in my logic I did not say that I cannot use the tools you listed.
Those are great tools and your compiler is a great tool as well.
I just said that your answer was not really the answer to that problem.
Your reply sounds much like "it is possible to get the 30 digits
of the Euler's constant, and you can get them from a library built in
the compiler system I wrote". This is a very comp.compilers.lcc answer.

-- 
Vincenzo Mercuri | www.backbox.org

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


#13705 — Re: Euler's constant

FromMarkus Wichmann <nullplan@gmx.net>
Date2011-11-21 14:10 +0100
SubjectRe: Euler's constant
Message-ID<38vpp8-qf8.ln1@voyager.wichi.de.vu>
In reply to#13693
On 21.11.2011 12:45, jacob navia wrote:
> Le 20/11/11 20:12, 88888 Dihedral a écrit :
>> PROBLEM 1: COMPUTE THE EULER'S NUMBER UP TO 30 DIGITS AFTER 1.
>> THE DIGIT REQUIRED SHOULD BE PARAMETER BY THE CALLER!
> 
> Euler's constant is the limit of the sum when N goes to infinity of:
> 
> 1 + 1/2 + 1/3 + 1/4 + ... 1/N - ln(n)
> 

Nope., but nearly. Perhaps you want to research the "harmonic series"
(or whatever name they gave it in english...). That series is divergent,
the reason being: For any natural number n there is a natural number m
so that Sum(i=0..m, 1/(n+i)) > 1. So the harmonic series adds up an
infinite number of ones and thus goes straight to Infinity. (Or rather,
any number you care to name gets exceeded by that series eventually.)

Euler's number is actually

1+ 1 + 1/2! + 1/3! + 1/4! + ...

So... to calculate the Euler number you'd actually need to keep track of
the current addend. Dunno, something like

e = 2;
factorial = 1;
fact_arg = 2;

for(;;) {
    factorial *= fact_arg++;
    addend = 1/factorial;
    e += addend;
}

Filling in the blanks and propably finding a decent library to code the
stuff with (or writing the library yourself... it is not hard if all you
want to do is multiplying and adding and you can wait a bit) is left as
an excercise to the reader.

> This is related to the PSI function (digamma) by
> 
> Euler constant = -psi(1)
> 
> This can be calculated in C with this program:
> (Using lcc-win. Other compilers will be able to do this too
>   but in a different way)
> 

So... basically you say this cannot be done in ISO C? Or is it just to
hard? Or do you want to promote yourself? And what the hell is psi()
meant to be? My man page collection doesn't know it and it knows stuff
like bessel functions...

Basically, I think we can all agree on the fact that a normal float or
double won't yield enough precision for thirty decimal places. On a
machine using IEEE 754 floating point types, a double has fifty two
binary places. That's 52*lg(2)~~ 15.6 decimal places. So we'd actually
have to write a multiprecision integer (for the factorial stuff) and
floating point library.

> d:\lcc\mc79\test>type teuler.c
> #include <qfloat.h>
> #include <specialfns.h>
> #include <stdio.h>
> int main(void)
> {
>          qfloat e=psiq(1.0q);
>          printf("Euler constant is:\n%.95qf\n",-e);
> }
> 

So, not only does this program feature strange types, it also has
unknown suffixes to literals and extensions to printf().

I don't know exactly, but I'd file this code under "Not C"!

HTH,
Markus

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


#13707 — Re: Euler's constant

Fromjacob navia <jacob@spamsink.net>
Date2011-11-21 15:36 +0100
SubjectRe: Euler's constant
Message-ID<jadnll$9mr$1@speranza.aioe.org>
In reply to#13705
Le 21/11/11 14:10, Markus Wichmann a écrit :
> On 21.11.2011 12:45, jacob navia wrote:
>> Le 20/11/11 20:12, 88888 Dihedral a écrit :
>>> PROBLEM 1: COMPUTE THE EULER'S NUMBER UP TO 30 DIGITS AFTER 1.
>>> THE DIGIT REQUIRED SHOULD BE PARAMETER BY THE CALLER!
>>
>> Euler's constant is the limit of the sum when N goes to infinity of:
>>
>> 1 + 1/2 + 1/3 + 1/4 + ... 1/N - ln(n)
>>
>
> Nope., but nearly. Perhaps you want to research the "harmonic series"
> (or whatever name they gave it in english...). That series is divergent,
> the reason being: For any natural number n there is a natural number m
> so that Sum(i=0..m, 1/(n+i))>  1. So the harmonic series adds up an
> infinite number of ones and thus goes straight to Infinity. (Or rather,
> any number you care to name gets exceeded by that series eventually.)
>
> Euler's number is actually
>
> 1+ 1 + 1/2! + 1/3! + 1/4! + ...
>
> So... to calculate the Euler number you'd actually need to keep track of
> the current addend. Dunno, something like
>
> e = 2;
> factorial = 1;
> fact_arg = 2;
>
> for(;;) {
>      factorial *= fact_arg++;
>      addend = 1/factorial;
>      e += addend;
> }
>
> Filling in the blanks and propably finding a decent library to code the
> stuff with (or writing the library yourself... it is not hard if all you
> want to do is multiplying and adding and you can wait a bit) is left as
> an excercise to the reader.
>
>> This is related to the PSI function (digamma) by
>>
>> Euler constant = -psi(1)
>>
>> This can be calculated in C with this program:
>> (Using lcc-win. Other compilers will be able to do this too
>>    but in a different way)
>>
>
> So... basically you say this cannot be done in ISO C?

No, as yo say, you can write your own exteded precision floats in C.
The core of lcc-win's qfloat library is written in assembler however.

> Or is it just to
> hard?

It depends of your budget/motivation if it is too hard. In any case it
was hard for me, but I did finish it.

> Or do you want to promote yourself?

I am doing exactly that: promoting the solutions I have built in
lcc-win.


> And what the hell is psi()
> meant to be?

Well, I gave the definition above. You can also look it up in wikipedia
or in Wolfram's site if you are interested.

> My man page collection doesn't know it and it knows stuff
> like bessel functions...
>

Yes, in your machine there is no hint at psi. How bad!

HINT: Get better software for it.

Note: The technical report ISO/IEC IS 14882:1998(E) proposes a
series of mathematical functions to be added to the standard library
in an optional statistics package.

Since I am a compiler writer I follow attentively those meetings and
I have implemented most of that proposal's functions. Among them

<quote>
double digamma(double x); // psi or digamma function.
<end quote>

At the beginning the proposal was designed only for C++ but later
it was extended for C also, and much reworked.

> Basically, I think we can all agree on the fact that a normal float or
> double won't yield enough precision for thirty decimal places.

Yes. I showed 95 decimal places.

> On a
> machine using IEEE 754 floating point types, a double has fifty two
> binary places. That's 52*lg(2)~~ 15.6 decimal places. So we'd actually
> have to write a multiprecision integer (for the factorial stuff) and
> floating point library.

Yes. That is what lcc-win has done already for you.

>
>> d:\lcc\mc79\test>type teuler.c
>> #include<qfloat.h>
>> #include<specialfns.h>
>> #include<stdio.h>
>> int main(void)
>> {
>>           qfloat e=psiq(1.0q);
>>           printf("Euler constant is:\n%.95qf\n",-e);
>> }
>>
>
> So, not only does this program feature strange types, it also has
> unknown suffixes to literals and extensions to printf().
>

Yes.

> I don't know exactly, but I'd file this code under "Not C"!

This is only a product of your *ignorance*. If you would care to
read the ISO C standard, you would notice that there is a section
called "Common extensions" where the standard EXPLICITELY mentions:

<begin quote>
J.5 Common extensions
1	The following extensions are widely used in many systems, but are not 
portable to all implementations.

[snip]

J.5.6 Other arithmetic types
1	Additional arithmetic types, such as __int128 or double double, and 
their appropriate conversions are defined (6.2.5, 6.3.1). Additional 
floating types may have more range or precision than long double, may be 
used for evaluating expressions of other floating types, and may be used 
to define float_t or double_t.
<end quote>

You do not know (or haven't read) what are you talking about.

Your only motivation is to make believe that my work is not standards
conforming, or otherwise impossible to use because of your
ideological "gut feelings"...


Like most people that attack me in this group.

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


#13710 — Re: Euler's constant

From88888 Dihedral <dihedral88888@googlemail.com>
Date2011-11-21 07:08 -0800
SubjectRe: Euler's constant
Message-ID<8656113.65.1321888126033.JavaMail.geo-discussion-forums@prgt40>
In reply to#13707
OK, I am just tired of GCC or VC. If LCC-WIN for 30EUROS can solve my projects I'll pay for that!

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


#13711 — Re: Euler's constant

Fromjacob navia <jacob@spamsink.net>
Date2011-11-21 16:16 +0100
SubjectRe: Euler's constant
Message-ID<jadq0d$fqg$1@speranza.aioe.org>
In reply to#13710
Le 21/11/11 16:08, 88888 Dihedral a écrit :
> OK, I am just tired of GCC or VC. If LCC-WIN for 30EUROS can solve my projects I'll pay for that!

You can download it at no cost from
http://www.cs.virginia.edu/~lcc-win32

If you like it you can donate what you want.

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


#13775 — Re: Euler's constant

FromNick Keighley <nick_keighley_nospam@hotmail.com>
Date2011-11-22 00:44 -0800
SubjectRe: Euler's constant
Message-ID<b6dada82-78a7-4ceb-ad5a-3dd233c915de@x7g2000yqb.googlegroups.com>
In reply to#13711
On Nov 21, 3:16 pm, jacob navia <ja...@spamsink.net> wrote:
> Le 21/11/11 16:08, 88888 Dihedral a écrit :

> > OK, I am just tired of GCC or VC. If LCC-WIN for 30EUROS can solve my projects
> > I'll pay for that!
>
> You can download it at no cost fromhttp://www.cs.virginia.edu/~lcc-win32

...for non-commercial purposes

> If you like it you can donate what you want.

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


#13712 — Re: Euler's constant

FromBen Bacarisse <ben.usenet@bsb.me.uk>
Date2011-11-21 15:33 +0000
SubjectRe: Euler's constant
Message-ID<0.b3c6dcd145bd54e047c3.20111121153354GMT.87y5v932xp.fsf@bsb.me.uk>
In reply to#13705
Markus Wichmann <nullplan@gmx.net> writes:

> On 21.11.2011 12:45, jacob navia wrote:
>> Le 20/11/11 20:12, 88888 Dihedral a écrit :
>>> PROBLEM 1: COMPUTE THE EULER'S NUMBER UP TO 30 DIGITS AFTER 1.
>>> THE DIGIT REQUIRED SHOULD BE PARAMETER BY THE CALLER!
>> 
>> Euler's constant is the limit of the sum when N goes to infinity of:
>> 
>> 1 + 1/2 + 1/3 + 1/4 + ... 1/N - ln(n)
>> 
>
> Nope., but nearly. Perhaps you want to research the "harmonic series"
> (or whatever name they gave it in english...). That series is divergent,
> the reason being: For any natural number n there is a natural number m
> so that Sum(i=0..m, 1/(n+i)) > 1. So the harmonic series adds up an
> infinite number of ones and thus goes straight to Infinity. (Or rather,
> any number you care to name gets exceeded by that series eventually.)

What Jacob wrote is not the harmonic series.  OK, it has a minor typo
(ln(n) should be ln(N)) but that does not seem to be what you are
commenting on.

> Euler's number is actually
>
> 1+ 1 + 1/2! + 1/3! + 1/4! + ...

There are two numbers that *might* go by that name, and the limit of the
series Jacob posted is one of them.  It is unambiguously named the
"Euler-Mascheroni Constant" and it often gets written as a lower-case
gamma.  e is so ubiquitous that it is only very rarely referred by any
other name, and I've never heard it called Euler's anything.

<snip>
-- 
Ben.

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


#13715 — Re: Euler's constant

FromMalcolm McLean <malcolm.mclean5@btinternet.com>
Date2011-11-21 08:50 -0800
SubjectRe: Euler's constant
Message-ID<855a6999-8a83-46e1-826f-5e690bd239c5@m7g2000vbc.googlegroups.com>
In reply to#13712
On Nov 21, 5:33 pm, Ben Bacarisse <ben.use...@bsb.me.uk> wrote:
> e is so ubiquitous that it is only very rarely referred by any
> other name, and I've never heard it called Euler's anything.
>
A Google turned up 836,000 uses of the phrase "Euler's number". Some
of those might refer to the telephone number of people called Euler,
but most will be e.

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


#13716 — Re: Euler's constant

From"BartC" <bc@freeuk.com>
Date2011-11-21 17:13 +0000
SubjectRe: Euler's constant
Message-ID<jae0t7$deo$1@dont-email.me>
In reply to#13715

"Malcolm McLean" <malcolm.mclean5@btinternet.com> wrote in message 
news:855a6999-8a83-46e1-826f-5e690bd239c5@m7g2000vbc.googlegroups.com...
> On Nov 21, 5:33 pm, Ben Bacarisse <ben.use...@bsb.me.uk> wrote:
>> e is so ubiquitous that it is only very rarely referred by any
>> other name, and I've never heard it called Euler's anything.
>>
> A Google turned up 836,000 uses of the phrase "Euler's number". Some
> of those might refer to the telephone number of people called Euler,
> but most will be e.

This doesn't make things any clearer. Is this number 2.718..., or 0.577..., 
or one of the sequence 1, 0, -1, 0, 5, 0, -61,... as suggested by Wikipedia? 
(I've already eliminated the ones that are obviously phone numbers.)


-- 
Bartc
 

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


#13719 — Re: Euler's constant

FromJames Kuyper <jameskuyper@verizon.net>
Date2011-11-21 12:29 -0500
SubjectRe: Euler's constant
Message-ID<4ECA8A76.8080405@verizon.net>
In reply to#13716
On 11/21/2011 12:13 PM, BartC wrote:
> 
> 
> "Malcolm McLean" <malcolm.mclean5@btinternet.com> wrote in message 
> news:855a6999-8a83-46e1-826f-5e690bd239c5@m7g2000vbc.googlegroups.com...
>> On Nov 21, 5:33 pm, Ben Bacarisse <ben.use...@bsb.me.uk> wrote:
>>> e is so ubiquitous that it is only very rarely referred by any
>>> other name, and I've never heard it called Euler's anything.
>>>
>> A Google turned up 836,000 uses of the phrase "Euler's number". Some
>> of those might refer to the telephone number of people called Euler,
>> but most will be e.
> 
> This doesn't make things any clearer. Is this number 2.718..., or 0.577..., 
> or one of the sequence 1, 0, -1, 0, 5, 0, -61,... as suggested by Wikipedia? 
> (I've already eliminated the ones that are obviously phone numbers.)

You've found numerous occurrences of 'e' as a symbol for 0.577... or one
of those sequences? Citations, please?

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


#13720 — Re: Euler's constant

FromMalcolm McLean <malcolm.mclean5@btinternet.com>
Date2011-11-21 09:28 -0800
SubjectRe: Euler's constant
Message-ID<c5a52ae0-6aae-4d8b-a27b-1b264d26cd79@w7g2000yqc.googlegroups.com>
In reply to#13716
On Nov 21, 7:13 pm, "BartC" <b...@freeuk.com> wrote:
> "Malcolm McLean" <malcolm.mcle...@btinternet.com> wrote in message
>
> news:855a6999-8a83-46e1-826f-5e690bd239c5@m7g2000vbc.googlegroups.com...
>
> > On Nov 21, 5:33 pm, Ben Bacarisse <ben.use...@bsb.me.uk> wrote:
> >> e is so ubiquitous that it is only very rarely referred by any
> >> other name, and I've never heard it called Euler's anything.
>
> > A Google turned up 836,000 uses of the phrase "Euler's number". Some
> > of those might refer to the telephone number of people called Euler,
> > but most will be e.
>
> This doesn't make things any clearer. Is this number 2.718..., or 0.577...,
> or one of the sequence 1, 0, -1, 0, 5, 0, -61,... as suggested by Wikipedia?
> (I've already eliminated the ones that are obviously phone numbers.)
>
2.718 - Euler's number
0.577 - Euler's constant
1, 0, -1, 0, 5, 0, -61 - the Euler numbers
0356 125670 - Euler's number

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


#13754 — Re: Euler's constant

FromBen Bacarisse <ben.usenet@bsb.me.uk>
Date2011-11-21 23:07 +0000
SubjectRe: Euler's constant
Message-ID<0.9b23c4b54d00d0cf22ec.20111121230705GMT.87k46t2hye.fsf@bsb.me.uk>
In reply to#13720
Malcolm McLean <malcolm.mclean5@btinternet.com> writes:

> On Nov 21, 7:13 pm, "BartC" <b...@freeuk.com> wrote:
>> "Malcolm McLean" <malcolm.mcle...@btinternet.com> wrote in message
>>
>> news:855a6999-8a83-46e1-826f-5e690bd239c5@m7g2000vbc.googlegroups.com...
>>
>> > On Nov 21, 5:33 pm, Ben Bacarisse <ben.use...@bsb.me.uk> wrote:
>> >> e is so ubiquitous that it is only very rarely referred by any
>> >> other name, and I've never heard it called Euler's anything.
>>
>> > A Google turned up 836,000 uses of the phrase "Euler's number". Some
>> > of those might refer to the telephone number of people called Euler,
>> > but most will be e.
>>
>> This doesn't make things any clearer. Is this number 2.718..., or 0.577...,
>> or one of the sequence 1, 0, -1, 0, 5, 0, -61,... as suggested by Wikipedia?
>> (I've already eliminated the ones that are obviously phone numbers.)
>>
> 2.718 - Euler's number
> 0.577 - Euler's constant
> 1, 0, -1, 0, 5, 0, -61 - the Euler numbers
> 0356 125670 - Euler's number

Or
Napier's constant: 2.718...
Euler-Mascheroni constant: 0.577...
Euler's numbers: 2, 12, 15, 22, 27, 35 bonus ball 19

-- 
Ben.

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


#13718 — Re: Euler's constant

FromKaz Kylheku <kaz@kylheku.com>
Date2011-11-21 17:29 +0000
SubjectRe: Euler's constant
Message-ID<20111121092839.491@kylheku.com>
In reply to#13715
On 2011-11-21, Malcolm McLean <malcolm.mclean5@btinternet.com> wrote:
> On Nov 21, 5:33 pm, Ben Bacarisse <ben.use...@bsb.me.uk> wrote:
>> e is so ubiquitous that it is only very rarely referred by any
>> other name, and I've never heard it called Euler's anything.
>>
> A Google turned up 836,000 uses of the phrase "Euler's number". Some
> of those might refer to the telephone number of people called Euler,
> but most will be e.

It's hard to imagine that someone with the mathematical stature of Euler
would be attributed with only one number. :)

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


#13721 — Re: Euler's constant

FromJames Kuyper <jameskuyper@verizon.net>
Date2011-11-21 12:36 -0500
SubjectRe: Euler's constant
Message-ID<4ECA8C2D.4070307@verizon.net>
In reply to#13718
On 11/21/2011 12:29 PM, Kaz Kylheku wrote:
> On 2011-11-21, Malcolm McLean <malcolm.mclean5@btinternet.com> wrote:
...
>> A Google turned up 836,000 uses of the phrase "Euler's number". Some
>> of those might refer to the telephone number of people called Euler,
>> but most will be e.
> 
> It's hard to imagine that someone with the mathematical stature of Euler
> would be attributed with only one number. :)

Nonetheless, there's only one thing commonly called "Euler's Number",
and a different thing called "the Euler constant", even though both of
them are numbers, and both are constants.

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


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

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


csiph-web