[9fans] Arithmetic on Plan 9
  Home FAQ Contact Sign in
comp.os.plan9 only
 
Advanced search
POPULAR GROUPS

more...

comp.os.plan9 Profile…
 Up
[9fans] Arithmetic on Plan 9         


Author: tlaronde
Date: Jul 25, 2007 08:55

Hello,

I'm working on KerGIS, a BSD licenced revival of CERL GRASS, in order to
make it compile and run on Plan 9 too---at the moment, it compiles and
runs on any POSIX Unix flavour.

Even if a huge amount of work has already been done for cleaning,
reorganizing and extending the original sources, confrontation with Plan
9 shows that it is far from being, if not ideal, even sensible in some
area.

The first step---for Plan 9---will be a compilation using APE, and the
development of a graphical visualization using Plan 9 libdraw.

But I need too, for Plan 9 and others, to isolate correctly arithmetic
operations (I include not only integers but floats too in this
expression) in order to identify correctly the domain of definition of
the algorithms.

AFAIK, ISO C for examples does not mandate anything about integer
overflows (may silently wraps). C99 has added some support for IEEE754,
but the handling of "exceptions"---that may or may not be faults---is
still fuzzy for me.
Show full article (2.46Kb)
4 Comments
[9fans] Re: Arithmetic on Plan 9         


Author: tlaronde
Date: Jul 25, 2007 09:00

[I forgot the references]:

On Wed, Jul 25, 2007 at 05:51:55PM +0200, tlaronde wrote:
> involves, obviously the machine---MMIX[1] for example has distinct

MMIX is the mythical RISC machine described by Donald E. Knuth in:

1 The Art of Computer Programming, Volume 1, Fascicle 1: MMIX, A RISC
Computer for the New Millenium, Addison-Wesley, 2005.

and

2 MMIXware, A RISC Computer for the Third Millennium, Springer, Lecture
Notes in Computer Science n°1750, 1999.
--
Thierry Laronde (Alceste)
http://www.kergis.com/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89 250D 52B1 AE95 6006 F40C
no comments
Re: [9fans] Arithmetic on Plan 9         


Author: andrey mirtchovski
Date: Jul 25, 2007 09:26

i may not be qualified to answer all those questions for you, but i'll
try my best. i was dealing with FP exceptions last week and
consequently may have some of the answers:
> 1) Is there a Plan 9 policy concerning the "notes" (exceptions) on
> arithmetic operations, both integer and float?

i don't think there's anything about integers, but float exception
behaviour can be controlled via the getfcr/setfcr routines described
in getfcr(2). that man page will also tell you how to figure out
whether a particular machine supports those.

in my particular case the code I was porting defined NaN as a constant
and threw an exception whenever it ran. one particular quirk that i
observed was that an exception was thrown regardless of whether I
defined a silent or a non-silent NaN... my "solution" was simply to
turn off FPINVAL via setfcr(). if you're porting via ape, as i was
doing, the best solution is to get the little bits of assembly that
constitute the *fcr routines, compile them with 8a and link them
against the
Show full article (2.37Kb)
no comments
Re: [9fans] Arithmetic on Plan 9         


Author: tlaronde
Date: Jul 25, 2007 11:26

On Wed, Jul 25, 2007 at 10:25:28AM -0600, andrey mirtchovski wrote:
> [good stuff]
>
> hope that helps.

Yes, definitively. Thank you very much!

It's almost clear that I need for KerGIS to orthogonalize things, so
that in the libgis are indeed system dependant (POSIX or Plan 9)
facilities and only these, and in a libarithm sys dep and machine
dependant arithmetic.

All the rest should be userland computation and almost usable as
is---minus the idiosynchrasies about C and libc [headers].

Thanks once more,
--
Thierry Laronde (Alceste)
http://www.kergis.com/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89 250D 52B1 AE95 6006 F40C
no comments
Re: [9fans] Arithmetic on Plan 9         


Author: tlaronde
Date: Jul 25, 2007 15:55

On Wed, Jul 25, 2007 at 10:25:28AM -0600, andrey mirtchovski wrote:
>[...]
> in my particular case the code I was porting defined NaN as a constant
> and threw an exception whenever it ran. one particular quirk that i
> observed was that an exception was thrown regardless of whether I
> defined a silent or a non-silent NaN... my "solution" was simply to
> turn off FPINVAL via setfcr(). if you're porting via ape, as i was
> doing, the best solution is to get the little bits of assembly that
> constitute the *fcr routines, compile them with 8a and link them
> against the

Perhaps a hint on this. In The Intel documentation (Intel64 and IA32
Architectures Software Developer's Manual, Volume 1, §4.8.3.4):

------quote
SNaNs are typically used to trap or invoke an exception handler.
They must be inserted by software; that is, the processor never
generates an SNaN as a result of a loating-point operation.
------endquote
Show full article (3.14Kb)
no comments