Port-vax archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Building current...



On 2015-12-02 04:14, Christos Zoulas wrote:
In article <565E5BE9.5090607%update.uu.se@localhost>,
Johnny Billquist  <bqt%update.uu.se@localhost> wrote:
On 2015-12-02 03:05, Christos Zoulas wrote:
In article <3F70DD86-0204-466E-8082-CBAD923F8B84%comcast.net@localhost>,
Paul Koning  <paulkoning%comcast.net@localhost> wrote:

On Dec 1, 2015, at 6:29 PM, Johnny Billquist <bqt%softjar.se@localhost> wrote:

After some hiatus, "my" VAX 8650 is back among the living, so I
decided to try and build current again.
...
Now the "analysis". It appears that programs call log10() with an
argument of 0, and consider this to be normal.
Unfortunately, this is one of those places where the VAX not doing
IEEE FP bites us. The IEEE log10() of 0 will return -inf, and happily
chug on. The VAX log10() of 0 will cause an illegal instruction trap.

I suspect the other programs crashing might be because of the same
reason. The question is - what should we do? I'm tempted to just change
the code for log() to return 0, or possible -MAX_whatever and not trap.
Opinions?

Why not simply fix the bug?  log(0) is invalid.  It's probably an
initialization error, where log() is used for some magic timekeeping
math that is only valid the second time around.

I fixed it.

Care to share some details of how you fixed it?

The code really want ilog2() it is an accident that it works anyway
because it clamps the entries. I made it not use the log if the number
of keys is <= 4. Check out this test program:

#include <stdio.h>
#include <math.h>
#include <sys/types.h>

#include <sys/bitops.h>

static inline u_short
auth_log2(double x)
{
         return (u_short)(log10(x) / log10(2));
}

int
main(void)
{
	unsigned long i;
	for (i = 0; i < 100; i++)
		printf("%lu %ld %ld\n", i, (long)auth_log2(i / 4.0) + 1,
		    (long)ilog2(i) - 1);
	return 0;
}

Yeah. Cool. Thanks. If you think that it truly was a bug then I guess I'd go back and hunt why gcc barfs on me as well... Maybe it is something else after all...

	Johnny

--
Johnny Billquist                  || "I'm on a bus
                                  ||  on a psychedelic trip
email: bqt%softjar.se@localhost             ||  Reading murder books
pdp is alive!                     ||  tryin' to stay hip" - B. Idol


Home | Main Index | Thread Index | Old Index