J Programming Language Implementation of 3-bit, 4-bit, 8-bit and 16-bit Precision Unums

313 views
Skip to first unread message

Skip Cave

unread,
Aug 16, 2016, 11:58:05 PM8/16/16
to Unum Computing
Roger Stokes has implemented a basic set of unums 2.0 in the J programming language, structured as a set of guided labs. Here's his post on the J forum:

The program includes auto generation of lookup tables for all four precisions.


Copy of post:

I've heard it said that you don't understand a subject
unless you can explain it to a computer. With that in mind
I've attempted a software implementation of Gustafson's Unums 2.0


If anyone is interested, there is a demo available in the

form of a J lab. To run the lab

       Download www.learningj.com/unumslab.zip

       Unzip into any convenient directory

       Follow directions in the readme file

Comments and criticisms appreciated.
<<<>>>

From the help file:
A "unum" represents a number, exactly or as an interval. A
set of unums is called a "SORN" (set of real numbers). A
compressed representation of a SORN will be callled a
compact SORN.

The lab will demonstrate arithmetic at 3-bit, 4-bit, 8-bit
and 16-bit precision, with these functions:

ufss Builds complete set of unums from starting set of
integers.

ssfn Builds simple examples of starting set, suitable
as argument to ufss

SFJN, CFS, CFJN, etc
Data type conversions: SORN from J number,
compact SORN from SORN etc

buildlookuptables
Build lookup tables to support arithmetic

plus minus times divide
Arithmetic functions, computing compact SORNs
from compact SORNs by table lookup

Plus Minus Times Divide
Arithmetic functions, computing compact SORNs
from compact SORNs without table lookup
)
<<<<>>>
Here's a more detailed setup process:

To run the J labs, download and install the JQT interpreter: http://www.jsoftware.com/stable.htm

Put John G's zipped files in a folder and extract the files to that folder. I put the unum files in a "unum" folder in my "projects" folder under the main j64-804-user folder.

For me, the unum files are in: C:/Users/yourame/j64-804-user/projects\unum

Start the JQT program -  C:/Users/yourname/j64-804-user/projects/unumame/j64-804/bin/jqt.exe

Then: select Tools|Package Manager|All|Install (this could take a while)

Wile the packages are installing, type the following line in the active J window:
   1!:44 'C:/Users/yourname/j64-804-user/projects/unum'

Then hit return to execute the line. 1!:44 is essentially the "Set Working Directory" command in J, so this tells J where you put the unum files. J always outputss three spaces when waiting for user input.

Then type the command: 
   load 'general/misc/fndef'
and hit 'enter'

This tells J to load some functions needed by the unum lab.

After the packages have finished installing, open the Lab dialog in JQT by navigating Help|Studio|Labs in the J IDE.

Then use the Browse button in the upper right of the lab selector and navigate to the unums.ijt file in the unum folder. Double-click the unums.ijt file to start the unums 2.0 tutorial.

The unum 2.0 Lab will start. After reading and experimenting with each lesson, Cntl-J will advance the lab to the next lesson. Initially the lab explains the basics, and then gradually leads you through using unums. There are 40 interactive lessons.

Each lab keeps you in a live J session, so you can type J commands (and perform various unum operations) at any time in any lab lesson.  The lab will lead you through creating a SORN, and then you will start working with unums. 

Skip

Reply all
Reply to author
Forward
0 new messages