source: mainline/uspace/dist/src/python/demo/sintab.py@ 77578e8

Last change on this file since 77578e8 was 77578e8, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 3 years ago

Whittle down more unlicensed files using my best guess as to the intended licensing

  • Property mode set to 100644
File size: 636 bytes
Line 
1#!/usr/bin/python
2#
3# SPDX-FileCopyrightText: 2022 HelenOS Project
4#
5# SPDX-License-Identifier: BSD-3-Clause
6#
7
8# Probably not very Pythonic, but it runs well with both Python2 and Python3
9
10import math
11import sys
12
13sys.stdout.write(" ")
14for frac_part in range(0,10):
15 sys.stdout.write(" %5d" % frac_part)
16print("")
17
18for angle_deg in range(0,90):
19 sys.stdout.write("%3d " % angle_deg)
20 for angle_deg_frac in range(0,10):
21 angle = math.radians(angle_deg + angle_deg_frac/10.)
22 value = math.sin(angle) * 10000 + 0.5
23 if value > 10000:
24 sys.stdout.write(" %05d" % (value))
25 else:
26 sys.stdout.write(" %04d" % (value))
27 print("")
28
Note: See TracBrowser for help on using the repository browser.