Port-vax archive

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

Re: Building current...



On 2015-12-02 02:06, John Klos wrote:
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?

You'd be making mathematicians and programmers alike cringe, but in the
grand scheme of things there really should be two uses for floating
point - one is where the results really do matter, in which case the
code is poor if it simply assumes a platform has infinities and NaNs,
and the other where it doesn't matter (like the KB/sec reported when
doing an scp -r which is never calculated correctly when the file starts
nor when it is completely finished).

I think that for every program where the results do matter (as far as
the user and the function of the program are concerned), there are ten
programs that are just bad at handling edge cases or are using floating
point in a lazy way and the results don't affect the running of the
actual program, so I'd be inclined to at least say to give it a go.

John

I cringe myself, but the question is if there is any better ways of dealing with it. I looked some more at the ntpd code, and it just assumes that log10(0) will always work, and -Inf is just fine. It's not even a NaN, so in fact, you can do operations on it. And then they instead have protections against having negative numbers in some places, which makes the code work in face of this.

	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