HDTenEightyP/NetNews huggingface dataset:
From: leonard@qiclab.scn.rain.com (Leonard Erickson)
Newsgroups: comp.programming
Subject: Re: how to calculate PI
Date: 23 Jan 93 08:07:18 GMT
Article-I.D.: qiclab.1993Jan23.080718.24306
Reply-To: Leonard.Erickson@f51.n105.z1.fidonet.org
Organization: SCN Research/Qic Laboratories of Tigard, Oregon.

rogerj@aix.rpi.edu (Diversion (Jeff Rogers)) writes:

>lowry@watson.ibm.com (Andy Lowry) writes:

>>In article <peterd.727508100@tscc2> peterd@tscc2.macarthur.uws.edu.au () writes:
>> > Anyone out there have an algorithm for calculating PI ?

>>One of the coolest formulas I've seen in Gregory's formula:

>>  pi/4 = 4*atan(1/5)-atan(1/239)

>Why not just 
>   pi/4=atan(1)? 

On several different machines I've found that 2*atan(maxreal) gives
a more accurate value for pi than 4*atan(1). And you don't really need
to be *that* accurate in the value for "maxreal". 1e[max exponent]
works fine.

-- 
Leonard Erickson		      leonard@qiclab.scn.rain.com
CIS: [70465,203]			 70465.203@compuserve.com
FIDO:   1:105/51	 Leonard.Erickson@f51.n105.z1.fidonet.org
(The CIS & Fido addresses are preferred)
Newsgroups: comp.programming
From: traal@lopez.marquette.MI.US (Brian Phillips)
Subject: MIX Software on the Internet?
Organization: Great White North/UPLink
Date: Mon, 25 Jan 1993 06:02:15 GMT


Does anyone out there know if MIX Software is on the Internet or in any way
can be reached via EMAIL?
MIX Software is best known for (I think) their Power C compiler & debugger,
and now for Multi-C (a portable, multi-threaded extension to C).
If anyone has any information, please respond by EMAIL, as I'm not sure if
my site gets all these groups.

  --Traal the BRAVE 
-- 
  EMAIL (the Good, the Bad, or the Flame) to:  traal@lopez.marquette.MI.US
   "Take a walk through the looking-glass and see the other side!" -- BPP
            "Realism is often misconstrued as pessimism." -- BPP
          "My mailer hates everybody, be sneaky." -- Mary Margret
From: orpheus@reed.edu (P. Hawthorne)
Newsgroups: comp.programming
Subject: DISMANTLE MICROSOFT (Was Re: Industry market shares)
Keywords: Microsoft
Date: 22 Jan 93 07:36:22 GMT
Article-I.D.: reed.1993Jan22.073622.21914
Organization: Reed College, Portland, OR


  nagle@netcom.com (John Nagle) reports:
: There's nothing to stop Microsoft from having it all.

  mroussel@alchemy.chem.utoronto.ca (Marc Roussel) chimes in with:
: ....except American law.

  Yeah, right. Uh, dude, wake up.

  American antitrust law is a newborn infant, and government in general can
be less than clueless when it comes to technology. Case in point, the
energy, chemical and medical industries. Laws designed to annoy the weak
trusts of Theodore Roosevelt's time do not adequately address the likes of
Microsoft, Warner or Sony.

  I'm going to use a mighty big "if" here, so take it with a grain of salt.
If and when the Federal Trade Commission musters the nerve to bloody
Microsoft's nose, odds are that they'll split off the operating systems
groups from the rest of Microsoft. Big deal.

  Rather more importantly, the compiler groups should be split up, split
off from every other group, the cash reserves of the company, and the
ownership of anyone with existing ties to Microsoft. The way Word and Excel
are cross compiled should be ample enough justification for that.

  There is a gaping hole in the theory of capitalism when preditors like
Microsoft can gain dominance in areas like computers that are so new and
rich with untapped potential. Aside from the need for our capitalist
society to address the issues of monopolies, kartels, and zaibatsus, we
also need to address the amount of resources and control weilded by
Microsoft right now.

  If the U.S. Government can't or wont stand up to them, who can or will?


  Prometheus Hawthorne - Jones (orpheus@reed.edu)
From: dpn2@po.CWRU.Edu (Damien P. Neil)
Newsgroups: comp.programming
Subject: Re: is it possible to find max & next smallest in one pass?
Date: Sun, 24 Jan 1993 18:42:05 GMT
Organization: Case Western Reserve University
NNTP-Posting-Host: b63519.student.cwru.edu

In article <hjv.727890482@groucho.phil.ruu.nl> hjv@phil.ruu.nl (Hendrik Jan Veenstra) writes:
>And what if 'value' lies *between* max1 and max2...?  Suppose you have to
>check for that too...
>So, supposing max1 is the biggest of the two, this would yield something like
>
>         if (value > max1)
>         {
>            max2 = max1;
>            max1 = value;
>         }
>         else if (value > max2)
>         {
>            max2 = value;
>         }

A faster way to write this would be:
   if (value > max2)
   {
      if (value > max1)
      {
         max2 = max1;
         max1 = value;
      } else {
         max2 = value;
      }
   }
This way, when the value is smaller than both maximums, only one compare is 
done.
-----
Damien Neil   dpn2@po.cwru.edu    "Until somebody debugs reality, the best
Case Western Reserve University    I can do is a quick patch here and there."
CMPS/EEAP double majoring masochist               - Erik Green
Newsgroups: comp.programming
From: jagrant@emr1.emr.ca (John Grant)
Subject: Re: how to calculate PI
Organization: Energy, Mines, and Resources, Ottawa
Date: Sun, 24 Jan 1993 04:43:29 GMT

In article <LOWRY.93Jan20104500@rotor.watson.ibm.com> lowry@watson.ibm.com (Andy Lowry) writes:
>In article <peterd.727508100@tscc2> peterd@tscc2.macarthur.uws.edu.au () writes:
> > Anyone out there have an algorithm for calculating PI ?
>
>One of the coolest formulas I've seen in Gregory's formula:
>
>  pi/4 = 4*atan(1/5)-atan(1/239)
>
>It's one of those formulas that makes you want to know how in the
>world anybody ever stumbled across it.
	[...stuff deleted...]

	Huh?  What's wrong with just plain ol'
		pi=4.0*atan(1.0);

-- 
John A. Grant						jagrant@emr1.emr.ca
Airborne Geophysics
Geological Survey of Canada, Ottawa
Newsgroups: comp.programming
From: mcasal@nyx.cs.du.edu (Massimo Casal)
Subject: scalb and rint
Organization: Nyx, Public Access Unix (sponsored by U. of Denver Math/CS dept.)
Disclaimer1: Nyx is a public access Unix system run by the University of
Disclaimer2: Denver for the Denver community.  The University has neither
Disclaimer3: control over nor responsibility for the opinions of users.
Date: Thu, 21 Jan 93 11:25:37 GMT

Hi!
i did a program using the scalb and the rint functions..
i included math.h ...i compiled with the -lm flag..but those functions don't work!!!!!!
maybe i have to use another flag...i'm sure i used them in the correct way..
help me!!

moreover i'd like to know how 'NaN' works...

addresses:
mcasal@nyx.cs.du.edu
casal@udmi5400.cineca.it

Thanx 
Max

Newsgroups: comp.programming
From: Dave Dodson <dodson@convex.COM>
Subject: Re: hashing floating-point numbers
Originator: dodson@bach.convex.com
Date: Mon, 25 Jan 1993 16:19:01 GMT
Reply-To: dodson@convex.COM (Dave Dodson)
Organization: Engineering, CONVEX Computer Corp., Richardson, Tx., USA
X-Disclaimer: This message was written by a user at CONVEX Computer
              Corp. The opinions expressed are those of the user and
              not necessarily those of CONVEX.

In article <1993Jan22.175723.17245@chpc.utexas.edu> pefv700@chpc.utexas.edu (Christopher Phillips) writes:
>What are the usual methods for hashing floating-point numbers
>given that numbers "equivalent" to a certain precision should
>hash to the same value?

I don't think you have specified the problem well.  Suppose you have
chosen a certain tolerance, epsilon, such that if x and y differ in
magnitude by less than epsilon ( abs(x-y) < epsilon ) then they hash
to the same value.  Now suppose that you have x, y, and z such that
x < y and y < z, but y-x < epsilon and z-y < epsilon.  Then x and y
have to hash to the same value, and y and z have to hash to the same
value, so x and z have to hash to the same value, even if z-x > epsilon.

Now, given any two floating point numbers, w and y, with w < y, you can
construct a net of values w < x1 < x2 < ... < xn < y, with each adjacent
pair differing by less than epsilon.  Then w hashes to the same value as
x1, which hashes to the same value as x2, ..., which hashes to the same
value as y.  So w and y hash to the same value for every w and y.  This
does not sound useful.

----------------------------------------------------------------------

Dave Dodson		                             dodson@convex.COM
Convex Computer Corporation      Richardson, Texas      (214) 497-4234
From: jagrant@emr1.emr.ca (John Grant)
Newsgroups: comp.programming
Subject: Re: is it possible to find max & next smallest in one pass?
Date: 27 Jan 93 22:39:47 GMT
Organization: Energy, Mines, and Resources, Ottawa

Thanks to all who responded.  I now have at least a dozen solutions,
most of which are similar.  In fact, the algorithm is relatively simple.
I just didn't think enough about it before posting my question.
Thank you, all of you.
-- 
John A. Grant						jagrant@emr1.emr.ca
Airborne Geophysics
Geological Survey of Canada, Ottawa
From: gowen@jade.tufts.edu (G. Lee Owen)
Newsgroups: comp.programming
Subject: Re: is it possible to find max & next smallest in one pass?
Date: 24 Jan 93 21:19:09 GMT
Distribution: na
Organization: Tufts University - Medford, MA


> Given an array of values, is it possible to find the maximum of
> the array and the next smallest value in a single pass?  The reason
	Yes.  Simple solution would be

float max = array[0]; 
float min = array[0];
for (i=0; i<ARRAYMAX; i++) {
  if (array[i] < min) min = array[i];
  if (array[i] > max) max = array[i];	
}

	Example is in C, should be easily translatable to most
languages. 

> If so, I guess the same single pass could also find the min and next
> highest value too?
	Of course, but not quite as simply.  You keep a second
variable -- say, max2 and min2 -- and when you find a new min, min2
gets the contents of min before min gets the contents of array[i].
You also have to allow for the case of equal numbers, and you need 
to find a way to set it to the 2nd min if there is nothing less than
array[0] (that is, the case where the contents of min are never
changed).  (of course, max as well).

--
--Greg Owen
	gowen@forte.cs.tufts.edu, gowen@jade.tufts.edu
"C Spot. C Spot run. C Spot run without a core dump! Run, Spot, Run!"
Newsgroups: comp.programming
From: rdippold@qualcom.qualcomm.com (Ron Dippold)
Subject: Re: DISMANTLE MICROSOFT (Was Re: Industry market shares)
Organization: Qualcomm, Inc., San Diego, CA
Date: Wed, 27 Jan 1993 00:44:49 GMT

Let Microsoft get too big and too arrogant and they'll find themselves
in the same boat as IBM.  Calling in the government to control them is
like getting the mafia to off someone because you think the person is
immoral.  They can't do anything but make it worse in the long run.
-- 
.. a government and its agents are under no general duty to provide public
services, such as police protection, to any particular individual citizen...
  -- Warren v. District of Columbia, 444 A.2d 1 (D.C. App.181)
Newsgroups: comp.programming
From: mjs@hubcap.clemson.edu (M. J. Saltzman)
Subject: Re: C specific editor (was Re: C/C++ Speed)
Organization: Clemson University, Clemson SC
Date: Thu, 21 Jan 1993 19:31:58 GMT

In article <47740001@hplvec.LVLD.HP.COM> elw@hplvec.LVLD.HP.COM (Eddie Williamson) writes:
>----------
>>>  In article <1993Jan15.160435.19703@acuson.com>,
>>>  miklg@acuson.com (Michael Goldman ) writes:
>
>>> The whole discussion of speed is limited to inexperienced people.  In
>>> real world applications, the hardware will double your speed in the
>>> time it takes to write the application.
>
>----------
>> hplvec:comp.programming 
>> kurt@tc.fluke.COM (Kurt Guntheroth) 
>> 9:54 am  Jan 18, 1993 /
>>
>> The net result is that in the *real* real world, efficiency is *always*
>> important.  In the synthetic real world imagined by acedemics, you can wave
>> your magic wand and say "just buy enough hardware to make it fast", but when
>> you are spending your own money, or money that comes out of your profit
>> sharing bonus, or from somebody other than nameless taxpayers, you have to
>> buy what you can afford, and live with what you buy.  
>----------
>I agree! (with the second paragraph)
>Most real world customers can't affort to go out and buy the latest
>hardware every time they buy new application software. They live with
>what they already have. Don't make excuses for being lazy. Design your
>software from the beginning with efficiency in mind. You'll end up

As an academic and a government employee, I'd just like to point out
that we don't get to spend nameless taxpayers' money just to go out
and buy new hardware every time we buy new software, any more than
anyone else.  In fact, we often don't even get to go out and buy the
software!  We also buy what we can afford and live with what we buy,
and we often live longer with less than many in the so-called real
world.

Algorithm designers don't abstract the constant factor away because
they think you can always make it up by buying new hardware--they do
it because they want to make a hardware-independent comparison of
algorithms.  On the other hand, it usually really is the case that
better asymptotic performance beats a constant-factor reduction (if
the constant isn't ridiculous to begin with), especially when it's
important (when problems get large).

If it's important to solve moderate-sized problems quickly, then the
constant *is* important.  But it's also often true that most of the 
constant factor can be had with attention to only a small portion of
the code.  You can almost always pick this up after the implementation 
is complete with careful profiling.
-- 
		Matthew Saltzman
		Clemson University Math Sciences
		mjs@clemson.edu
From: elw@hplvec.LVLD.HP.COM (Eddie Williamson)
Date: Tue, 19 Jan 1993 16:03:08 GMT
Subject: Whence Archie??
Organization: Hewlett-Packard Co., Loveland, CO
Newsgroups: comp.programming

I've seen references here to a utility called Archie. Can someone tell
me what it is and where to get it? It sounds like a network search
From: phusek@quirky.phy.duke.edu (Paul Husek)
Newsgroups: comp.programming
Subject: Re:how about Prime Numbers?
Date: 28 Jan 93 16:55:13 GMT


I thought the way they came up with large prime numbers was to perform a  
test on them which had a 1/x probability of revealing a prime number if it  
were prime, where x is of the order of 2.  If you perform this test (with  
varying parameters) n times then you have a 1/x^n chance of mistaking a  
nonprime number for a prime.  Do it 100 times and your pretty damn certain  
if it passes all these tests its prime.

	I think Corman, Rivest, etc in Intro to Algorithms has a  
discussion on this.
--
	Paul Husek 				1-919-383-3535                             
	Duke University Dept. of Physics	phusek@phy.duke.edu    
	Durham, N.C.      27706
From: hoey@zogwarg.etl.army.mil (Dan Hoey)
Newsgroups: comp.programming
Subject: Re: Virus Programs 4 Sale  (Virus, Trojans, etc)
Date: 27 Jan 93 19:01:08 GMT
Organization: Naval Research Laboratory, Washington, DC
Supersedes: <1309@zogwarg.etl.army.mil>

alby@access.digex.com (Albatross) writes:
...
>                            VIRUS'es    FOR    SALE
>Cost:            $20.00 per disk
>Contents:        10 Viri  per disk
>        I will hold NO responsiblity for such actions,
>        if incidents are incurred.

Be sure to mention that to the judge.  It always helps to inject some
lighthearted courtroom humor to set the tone for your sentencing.

smith@ctron.com (Larry Smith) writes:

>On the other hand, the original poster's suggestion that it be used to test
>virus detection software or procedures is a valid one.  It is also easy to
>imagine someone with a neat new idea for zapping compuviruses and would like
>a few real-life examples to see if it works before taking it to market.  And
>I'd much rather he test his new software with _known_ viruses, rather than
>writing some to see if it works, if you take my drift...

It is possible to manufacture files that appear to be infected but are
not infectious, and programs that appear to act as viruses but do not spread.
These are quite sufficient to test your software.

On the other hand, testing your virus software by trying to infect
your disk with real viruses is like testing your vaccination by buying
a rabid dog to bite you.  It is so ridiculous that no one would take
seriously such a pretext from a mad dog vendor.

dave@cs.arizona.edu (Dave Schaumann) writes:
>kramer893@snake.cs.uidaho.edu (Brian Kramer) writes:

>>There is no difference between one piece of software and another if
>>they are made of the same binary bits.

>Could you explain what you mean by this?

He means the usual thing: ``My contraband is legal because it is made
of the same stuff as this obviously legal thing.''  Like ``My heroin
is legal because it's made of the same carbon, nitrogen, and oxygen as
my petunias'' or ``My atom bomb is legal because it's made of the same
protons, neutrons, and electrons as my toaster.''

Dan Hoey
Hoey@AIC.NRL.Navy.Mil
From: dave@cs.arizona.edu (Dave Schaumann)
Newsgroups: comp.programming
Subject: Re: how to calculate PI
Date: 24 Jan 93 06:01:53 GMT
Reply-To: dave@cs.arizona.edu (Dave Schaumann)
Organization: University of Arizona

This discussion just jogged loose a bit of trivia from my brain...

Theres a book called _Etudes for Programmers_ by Charles Wetherell.
Like the title suggests, its got a bunch of good-sized project ideas
for the idle programmer.

One of them concerns calculating PI to many digits.  Besides suggestions
for formulas to use, there is also discussion on implementing very
high precision numbers, and at least a pointer to a fast multiply
algorithm.

As I recall, each section also includes a short bibliography of
related works.

-- 
You unlock this door with the key of imagination.  Beyond it is another
dimension: a dimension of sound, a dimension of sight, a dimension of mind.
You're moving into a land of both shadow and substance, of things and ideas.
You've just crossed over into... the Twilight Zone.
From: jos@and.nl (Jos Horsmeier)
Newsgroups: comp.programming
Subject: Re: is it possible to find max & next smallest in one pass?
Date: 24 Jan 93 12:49:32 GMT
Organization: AND Software BV Rotterdam

In article <asean.727858796@armstrong.ecn.purdue.edu> asean@armstrong.ecn.purdue.edu (Sean Ahern) writes:
|jagrant@emr1.emr.ca (John Grant) writes:
|>Given an array of values, is it possible to find the maximum of
|>the array and the next smallest value in a single pass?  The reason
|>I want it in one pass, is that the array is actually a data file
|>of a million float values.
|>
|>If so, I guess the same single pass could also find the min and next
|>highest value too?
|
|If you were able to do this, the algorithm should be able to extend to the
|next smallest, and the next, with little or no trouble.
|
|But the requirement of the algorithm was to do this in one pass.  This would
|give us an O(n) sorting algorithm that works on arbitrary data.  I don't
|believe such an animal exists with only one processor.

I beg to differ here. Lets do some big Oh calculations. Given n elements
in an array, one can find the maximum value in O(n) operations. One can 
find the next value in O(n) operations too, so both can be done in 
O(n)+O(n)= O(2*n) operations. But constants don't count here, so the
whole job can be done uisng O(n) operations. Finding three elements,
takes O(3*n)= O(n) operations, and so on. But sorting all n elements
this way takes up O(n*n) operations, which is, in fact, quite a lousy
way of sorting an array. But lets get back to the original problem,
here is a simple solution:

m1 = a[1]			// m1 >= m2 
m2 = a[1]

loop: i = 2 .. n		// compare a[i], m1 and m2

	if a[i] > m2 then	// is it a candidate?
		m2 = a[i]

	if m2 > m1 then		// is it the largest?
		swap m1, m2	

result: m1, m2

I hope this clarifies things a bit,

kind regards,

Jos aka jos@and.nl
Newsgroups: comp.programming,comp.human-factors
From: sjm@bcrki65.bnr.ca (Stuart MacMartin)
Subject: Re: C/C++ Speed
Organization: Bell-Northern Research Ltd., Ottawa, Canada
Distribution: na
Date: Thu, 21 Jan 1993 13:34:32 GMT

In article <1993Jan20.180908.8784@tc.fluke.COM> kurt@tc.fluke.COM (Kurt Guntheroth) writes:
>OK, OK, efficiency is only *almost* always important.

Now I agree with you.

BTW, I was not talking about an entire application being inefficient
so much as particular functions that might rarely be used.  And it
went very much against my grain to disagree with you in the first
place.

Stuart
--
: Stuart MacMartin                                    email: sjm@bnr.ca      :
: Bell-Northern Research                              phone: (613) 763-5625  :
: PO Box 3511, Stn C, Ottawa, K1Y-4H7, CANADA    Standard disclaimers apply. :
Newsgroups: comp.programming
From: lowry@watson.ibm.com (Andy Lowry)
Subject: Re: how to calculate PI
Date: Thu, 21 Jan 1993 17:19:50 GMT
Disclaimer: This posting represents the poster's views, not necessarily those of IBM
	<c8h3xpm@rpi.edu>
Organization: IBM T.J. Watson Research Center

In article <c8h3xpm@rpi.edu> rogerj@aix.rpi.edu (Diversion (Jeff Rogers)) writes:
 > lowry@watson.ibm.com (Andy Lowry) writes:
 > 
 > >In article <peterd.727508100@tscc2> peterd@tscc2.macarthur.uws.edu.au () writes:
 > > > Anyone out there have an algorithm for calculating PI ?
 > 
 > >One of the coolest formulas I've seen in Gregory's formula:
 > 
 > >  pi/4 = 4*atan(1/5)-atan(1/239)
 > 
 > Why not just 
 >    pi/4=atan(1)? 
 > If your answer is in radians, this works too, but
 > I think it requires prior knowledge of pi. 
 > 
 > >In any case, you can use Taylor expansion to get atan(1/5) and
 > >atan(1/239).  I understand there are more high-powered schemes out
 > 
 > Maybe this is the answer (to my question above), but I don't see why a
 > taylor expansion would work for some values and not others.

Of course you can use atan(1), but the series won't converge anywhere
near as quickly.  The series for atan(x) is:

   atan(x) = x - x^3/3 + x^5/5 - + ... + (-1)^(n-1)x^(2n-1)/(2n-1) + ...

For x=1, you get 1 - 1/3 + 1/5 - 1/7 + ..., which converges
exceedingly slowly.  For x = 1/5 or x = 1/239 you get reasonably fast
convergence... fast enough for many thousands of decimal places with a
reasonably short computation on any modern machine.

Besides, part of the reason I posted Gregory's formula is that it's
such a bizarre formula.  As I mentioned in my original post, I can't
imagine how anybody ever stumbled onto it.  It's like whipped cream...
what in the world inspired the first cream-whipper to do it?
--
Andy Lowry, lowry@watson.ibm.com, (914) 784-7925
IBM Research, P.O. Box 704, Yorktown Heights, NY  10598
Newsgroups: comp.programming
From: bosullvn@unix1.tcd.ie (Bryan O'Sullivan)
Subject: Re: how to calculate PI
Organization: Computer Science Department, Trinity College, Dublin, Ireland
Date: Thu, 21 Jan 1993 11:29:25 GMT

rogerj@aix.rpi.edu (Diversion (Jeff Rogers)) writes:

>>Andy Lowry writes:

>>  pi/4 = 4*atan(1/5)-atan(1/239)

>Why not just 
>   pi/4=atan(1)? 
>If your answer is in radians, this works too, but
>I think it requires prior knowledge of pi. 

Exactly.  It's a bit circular, no?  Seems the formula Andy Lowry
quotes better lends itself to Taylor Series expansion.

>... but I don't see why a taylor expansion would work for some values
>and not others.

Seems to work for all values, but I could well be wrong.  I've got
a (totally uncommented and rather obtuse) variant of Gregory's
algorithm written in C which churns out values fairly quickly; it's
not particularly optimised, but takes about 7 seconds to churn out
1000 digits of pi on an unloaded SPARCstation.

I've not looked at any analyses, but it seems that Gregory's
algorithm gets roughly exponentially slower with the number of
digits of precision required.  Or perhaps it's just the variant I
have.

	<b
--
SCRG, Department of Computer Science, Trinity College
Newsgroups: comp.programming