In attempting to port the Persistence of Vision 1.0 ray tracing
package, I encountered one problem with Linux (MCC-Intermin 0.96c
with gcc 2.2.2). There appears to be no support for the matherr()
function that is normally part of math library libm.a. There was
at least a stub function (matherr.o) in the libm.a library of all
the Unix systems I tried (SunOS 4.1.1, HP-UX 8.05, and even Apollo
DomainOS 10.3). Try a 'man matherr' for detailed information on
how to use matherr().
This user supplied function is used to trap floating point exceptions.
Also all these other systems contain lines like the following in
<math.h>:
struct exception {
int type;
char *name;
double arg1;
double arg2;
double retval;
};
#define DOMAIN 1 /* argument domain error */
#define SING 2 /* argument singularity */
#define OVERFLOW 3 /* overflow range error */
#define UNDERFLOW 4 /* underflow range error */
#define TLOSS 5 /* total loss of significance */
#define PLOSS 6 /* partial loss of significance */
By adding these lines to <math.h> I could get the program to
compile, but the executable gets floating point exception errors
and core dumps on many of the provided input files. Others input
files will run to completion without problems. I even tried
changing all references of 'exception' to 'libm_exception' since
I had seen this used by gcc on some ports, but the results were
the same - floating point exceptions still occur.
Here's an example of using matherr() that I extracted from the
man page:
#include <math.h>
int
matherr(x)
register struct exception *x;
{
switch (x->type) {
case DOMAIN:
/* change sqrt to return sqrt(-arg1), not 0 */
if (!strcmp(x->name, "sqrt")) {
x->retval = sqrt(-x->arg1);
return (0); /* print message and set errno */
}
case SING:
/* all other domain or sing errors, print message, abort */
fprintf(stderr, "domain error in %s\n", x->name);
abort( );
case PLOSS:
/* print detailed error message */
fprintf(stderr, "loss of significance in %s(%g) = %g\n",
x->name, x->arg1, x->retval);
return (1); /* take no other action */
}
return (0); /* all other errors, execute default procedure */
}
Performance of Persistence of Vision 1.0 under Linux is very good (at
least I'm not complaining). I have a 25MHz 386DX with 8MB of RAM and a
Cyrix 387. The program compiled under Linux 0.96c with gcc 2.2.2 runs
about 1.8 times faster than the DOS executable (32-bit 386 protected
mode) compiled with Intel's Code Builder. The only problem is I can't
do all the ray traces under Linux because many of the input files
will abort with floating point exceptions.
By the way Persistence of Vision 1.0 is available from:
alfred.ccs.carleton.ca (134.117.1.1) in pub/pov-ray/POV-Ray1.0.
The following files are for Unix systems:
povdoc.tar.Z Documentation
povscn.tar.Z Scene data files
povsrc.tar.Z Source code
Is support for matherr() provided in newer versions of gcc for Linux?
I see there is a 2.2.2d out now which I don't have yet. If not, could
it be added without to much trouble? In the interim, does anyone know
of a reasonable work around? Thanks.
--
Steve Snyder
snyde_sl@otsc.eds.com
uunet!tsca02!snyde_sl
| Ingo Molnar | Re: [PATCH 00/34] AMD IOMMU driver |
| Linus Torvalds | Linux 2.6.27-rc8 |
| Greg KH | [GIT PATCH] driver core patches against 2.6.24 |
| Ryan Hope | reiser4 for 2.6.27-rc1 |
git: | |
| Linus Torvalds | Re: [kernel.org users] [RFD] On deprecating "git-foo" for builtins |
| Jon Smirl | Re: VCS comparison table |
| Junio C Hamano | Re: [PATCH] Teach remote machinery about remotes.default config variable |
| Dmitry Kakurin | Re: Git on MSys (or how to make it easy for Windows users to compile git) |
| Octavian Purdila | race in skb_splice_bits? |
| Wolfgang Walter | Re: Kernel oops with 2.6.26, padlock and ipsec: probably problem with fpu state ch... |
| Ingo Molnar | Re: [bug, netconsole, SLUB] BUG skbuff_head_cache: Poison overwritten |
| Rick Jones | Re: 2.6.24 BUG: soft lockup - CPU#X |
| Richard Stallman | Real men don't attack straw men |
| chefren | Kuro5hin: OpenBSD Founder Theo deRaadt Has Conflict of Interest With AMD |
| Pieter Verberne | File collision while using pkg_add |
| Jason Dixon | Re: Hardware recommendation for firewalls (more than 4 NICs) |
