[Oberon] FP

Jörg joerg.straube at iaeth.ch
Tue Apr 15 13:17:14 CEST 2014

Hi all

Indeed. The FP code in the emulator is an example of "backporting assembler
to C". PdW could have taken the "normal" FP arithmetic offered by C and let
the C compiler decide to generate the code. 
The FP format NW uses is the same as C, namely IEEE single precision.

So, PdW could have written something like:
uint32_t fp_add(uint32_t x, uint32_t y, bool u, bool v);
  float *a = (float *)(&x); /* aka reinterpret_cast in C++ */
  float *b = (float *)(&y);

/* do whatever you want to do with the FP numbers a and b */
  float sum, prod;
  sum = *a + *b;
  prod = *a * *b;


-----Original Message-----
From: Paul Onyschuk [mailto:ptmelville at gmail.com] 
Sent: Dienstag, 15. April 2014 11:33
To: ETH Oberon and related systems
Subject: Re: [Oberon] FP

On Tue, 15 Apr 2014 10:33:08 +0200
Jan Verhoeven <jan at verhoeven272.nl> wrote:

> Our latest 2014 FPGA processor (and hence the emulator) uses 1/4 
> machineword for the exponent and 3/4 machineword for the mantissa.

One of the reasons behind it is distribution of numbers: you want more
precision as you get closer to 0.

I didn't look close at part of Project Oberon describing construction
of computer yet, but I guess that REAL is single precision floating
point number.  Most standard implementations of float do exactly what
you described.  I would welcome double point precision float numbers in
Oberon instead, but mantissa:exponent size ratio in standard
implementations is far from 1:1.  Double according to IEEE uses 53-bit
mantissa and 11-bit exponent.  This representation is well recognized
and studied - you can find information about numerical analysis of
those numbers easily, which isn't true for what you propose.

There is book written by Randall Hyde called "Art of Assembly", which
has wonderful section which describes data representation, including
floating point numbers (nice diagrams and such).  It is available for
free in HTML form [1]. 

[1] http://goo.gl/PdOQlx

Paul Onyschuk

Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 6097 bytes
Desc: not available
Url : https://lists.inf.ethz.ch/pipermail/oberon/attachments/20140415/332dfc4c/attachment.bin 

More information about the Oberon mailing list