Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
statespacedev committed Sep 21, 2024
1 parent bf8960c commit 9f566f2
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ lang-sentences*
/venv310/
/cmake-build-debug-docker/
/build-docs/
.vscode
/a.out.dSYM/
a.out
21 changes: 21 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "for",
"type": "cppdbg",
"request": "launch",
"preLaunchTask": "ipwr",
"program": "${workspaceFolder}/a.out",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb"
},
]
}
10 changes: 10 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "ipwr",
"command": "gfortran pdp10/algebra/ipwr.for -g -O0 -fbacktrace -fcheck=all -ffpe-trap=zero,overflow,underflow -Wall -Wextra -Warray-temporaries -Wconversion -ffree-line-length-0",
}
]
}
10 changes: 10 additions & 0 deletions pdp10/algebra/ipwr.for
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

program hello
integer :: i
real :: pi
pi = 3.1415927
i = 0
i = i + 1
print *, 'Hello, World!', pi
end program hello

14 changes: 13 additions & 1 deletion pdp10/algebra/ipwr.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
""" imaginary powers of base 10. starting with 10**(i/1024), and squaring successively ten times"""
""" imaginary powers of base 10. starting with 10**(i/1024), and squaring successively ten times. this matches with feynman's table 22-3"""
from math import sqrt

# non rounded version
y = .00225 # should be .0022486
x = sqrt(1. - y**2)
for _ in range(11):
print('%10.7f %10.7f' % (x, y))
x2 = x**2 - y**2
y2 = 2 * x * y
x, y = x2, y2

# rounded version that more closely matches feynman's table 22-3
y = .00225 # should be .0022486
x = round(sqrt(1. - y**2), 7)
for _ in range(11):
print('%10.5f %10.5f' % (x, y))
x2 = round(x**2 - y**2, 7)
y2 = round(2 * x * y, 7)
x, y = x2, y2

0 comments on commit 9f566f2

Please sign in to comment.