Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
pi
Commits
6d424277
Commit
6d424277
authored
2 years ago
by
Neil Gershenfeld
Browse files
Options
Downloads
Patches
Plain Diff
+Micro
parent
009705ed
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#24280
passed
2 years ago
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Python/micropi.py
+28
-0
28 additions, 0 deletions
Python/micropi.py
README.md
+1
-1
1 addition, 1 deletion
README.md
with
29 additions
and
1 deletion
Python/micropi.py
0 → 100755
+
28
−
0
View file @
6d424277
#
# micropi.py
# Neil Gershenfeld 12/26/22
# calculation of pi by a MicroPython sum
# pi = 3.14159265358979323846
#
import
time
,
machine
NPTS
=
1000000
@micropython.native
def
calc
():
a
=
0.5
b
=
0.75
c
=
0.25
pi
=
0
for
i
in
range
(
1
,(
NPTS
+
1
)):
pi
+=
a
/
((
i
-
b
)
*
(
i
-
c
))
return
pi
machine
.
freq
(
250000000
)
start_time
=
time
.
time
()
pi
=
calc
()
end_time
=
time
.
time
()
mflops
=
NPTS
*
5.0
/
(
1.0e6
*
(
end_time
-
start_time
))
print
(
"
NPTS = %d, pi = %f
"
%
(
NPTS
,
pi
))
print
(
"
time = %f, estimated MFlops = %f
"
%
(
end_time
-
start_time
,
mflops
))
This diff is collapsed.
Click to expand it.
README.md
+
1
−
1
View file @
6d424277
...
...
@@ -54,7 +54,7 @@
|0.001|prior|Sun SPARCStation 1|C|prior|
|0.001|prior|DEC VAX 8650|C|prior|
|0.0007|prior|Intel 486|C|prior|
|0.000
2
1|
[
pi.py
](
Python/pi.py
)
|MicroPython, 250 MHz|RP2040|December, 2022|
|0.000
3
1|
[
pi.py
](
Python/
micro
pi.py
)
|MicroPython, 250 MHz|RP2040|December, 2022|
|0.0002|
[
pi.ino
](
Arduino/pi.ino
)
|Arduino, floats|ATSAMD21E|December, 2020|
|0.0001|
[
pi.ino
](
Arduino/pi.ino
)
|Arduino, floats|ATtiny1614|December, 2020|
|0.00003|prior|Sun 3/60|C|prior|
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment