473,806 Members | 2,371 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

algorithm for finding Pi in C

42 3835
On Jun 2, 6:29 pm, Keith Thompson <ks...@mib.orgw rote:
vipps...@gmail. com writes:
On May 28, 8:17 am, "Dann Corbit" <dcor...@connx. comwrote:
"pete" <pfil...@mindsp ring.comwrote in message
news:e7******* *************** ********@earthl ink.com...
aark...@gmail.c om wrote:
see:-http://mathforum.org/library/drmath/view/54456.html
This works for me:
#include <float.h>
/*
** pi == (atan(1.0 / 3) + atan(1.0 / 2)) * 4
*/
Don't you mean pi == (atan(1.0 / 3) + atan(1.0 / 2)) * 4?

Your "correction " was exactly the same as what pete wrote.
Indeed, I apologize. I was tired at the time.
Jun 27 '08 #41
user923005 <dc*****@connx. comwrote:
On Jun 2, 1:51=A0am, James Dow Allen <jdallen2...@ya hoo.comwrote:
[snip]
While Googling for pi =3D 3, I also found that
this approximation is dictated by the Bible
in Chronicles II: 4:2-5.
From:
http://mathworld.wolfram.com/Pi.html
"The Bible contains two references (I Kings 7:23 and Chronicles 4:2)
which give a value of 3 for pi (Wells 1986, p. 48). It should be
mentioned, however, that both instances refer to a value obtained from
physical measurements and, as such, are probably well within the
bounds of experimental uncertainty."
[snip]
Oh, come on. It's much more cut and dried than that. In both cases, the
measurements are given with one single digit of precision. So all they
state is that, to within that single digit, pi is 3. Guess what? _To
within that one digit_, pi _is_ 3.

Richard
Jun 27 '08 #42
In article <48************ ****@news.xs4al l.nl>,
Richard Bos <rl*@hoekstra-uitgeverij.nlwr ote:
>Oh, come on. It's much more cut and dried than that. In both cases, the
measurements are given with one single digit of precision.
You can't the intended precision just by looking at the data. 10 and
30 cubits *might* be accurate to one significant figure. More likely,
they're intended to be accurate to the nearest cubit. The fact that
they are multiples of 10 may well have been a deliberate choice in the
actual size rather than indicating the precision of the reported
values.

-- Richard
--
In the selection of the two characters immediately succeeding the numeral 9,
consideration shall be given to their replacement by the graphics 10 and 11 to
facilitate the adoption of the code in the sterling monetary area. (X3.4-1963)
Jun 27 '08 #43

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

22
9938
by: Bernard Fields | last post by:
Greets, all. As the title suggests, I'm trying to make a maze. Specifically, it's a top-down, 2-d maze, preferably randomly generated, though I'm willing to forego that particular aspect as this point. I've done many, many web-searches, but nothing that I've found so far has provided any clues....
3
2759
by: ckroom | last post by:
Anyone knows a good algorithm to get the next prime of a number n? prime = nextprime( n ); It's for some stuff about double rehashing, thanks. -- ckroom http://nazaries.net/~ckroom
4
5638
by: m sergei | last post by:
I am not asking for code but wanted help with understanding the algorithm to permute all characters of a string. say string is "ABCD" I want to know the algorithm for finding all permutations of the given string, without recursion and with recursion.
12
14872
by: Erik the Red | last post by:
In Fundamental Algorithms (The Art of Computer Programming), the first algorithm discussed is Euclid's Algorithm. The only idea I have of writing this in python is that it must involve usage of the modulo % sign. How do I write this in python?
16
6773
by: a | last post by:
We are writing an app that assigns people to teams based on their curent score. Teams are 8 people, there are 2 teams. (i would like it to be flexible, but this is a start). I need an algorithm that creates the 2 teams such that the total score for each team is as close as possible. Any ideas?? Thanks!
2
2150
by: Sherrie Laraurens | last post by:
Hi all, I'm trying to write a generic algorithm routine that will take begin and end iterators of a container, iterate through the range and perform a "calculation" of sorts. The trouble is that the algorithm will behave differently for the two different types. I've considered calling the algorithm foo_A and foo_B, but I don't like that approach because it will blow out in naming complexity down the track.
4
2642
by: sklett | last post by:
I realize this could be a little off-topic, but there are some great minds on this NG and I hope you can let me slide this time ;0) I'm designing our system to manage what products can fit in which cartons and how many per carton. For example: Widget A measures 10W x 10H x 10D Carton A measures 20W x 10H x 10D Carton B measures 50W x 10H x 10D If I'm fulfilling an order for 2 Widget As I can choose Carton A as it will
4
32087
prometheuzz
by: prometheuzz | last post by:
Hello (Java) enthusiasts, In this article I’d like to tell you a little bit about graphs and how you can search a graph using the BFS (breadth first search) algorithm. I’ll address, and hopefully answer, the following questions: • what is a graph? • how can a graph be represented as an ADT? • how can we search/walk through a graph using the BFS algorithm?
2
4664
by: shashankbs | last post by:
Given a topology and a certain node X, find the shortest path tree with X as the root. * Input: a topology file similar to the following (which is a three-node ring) -------------------------------------------- Nodes: (3) // there are three nodes (node 0, 1 and 2) Edges: (3)
1
14215
by: Glenton | last post by:
Hi All Here is a very simple little class for finding a shortest route on a network, following Dijkstra's Algorithm: #!/usr/bin/env python #This is meant to solve a maze with Dijkstra's algorithm from numpy import inf from copy import copy
0
9719
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9597
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10366
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10371
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9187
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7649
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6877
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.