Taylor R Campbell [Fri, 30 Nov 2018 01:26:31 +0000 (01:26 +0000)]
Add some more edge cases for sqrt.
Taylor R Campbell [Fri, 30 Nov 2018 01:03:30 +0000 (01:03 +0000)]
Test exceptions in sqrt too.
Taylor R Campbell [Fri, 30 Nov 2018 00:53:48 +0000 (00:53 +0000)]
Test flo:negate.
Taylor R Campbell [Fri, 30 Nov 2018 00:53:05 +0000 (00:53 +0000)]
Add some more sqrt edge cases.
Taylor R Campbell [Fri, 30 Nov 2018 00:47:15 +0000 (00:47 +0000)]
Fix mistranscription of opcode for UNPCKLF.
Taylor R Campbell [Thu, 29 Nov 2018 05:30:04 +0000 (05:30 +0000)]
Add some more copysign tests.
Taylor R Campbell [Thu, 29 Nov 2018 03:05:53 +0000 (03:05 +0000)]
Floating-point total ordering.
- (flo:total< x y) is true if x < y in the total ordering on
floating-point values defined in IEEE 754-2008 Sec. 5.10, i.e. this
is the totalOrder function of IEEE 754-2008 Sec. 5.7.2.
- (flo:total-order x y) is -1 if x < y, 0 if x = y, +1 if x > y in the
total ordering -- the three-way comparison version of total<.
- (flo:total-mag< x y) = (flo:total< (flo:abs x) (flo:abs y))
- (flo:total-order-mag x y)
= (flo:total-order (flo:abs x) (flo:abs y))
While here, tweak release notes on flonum stuff.
Taylor R Campbell [Thu, 29 Nov 2018 02:57:09 +0000 (02:57 +0000)]
sqrt is busted on infinities.
Taylor R Campbell [Thu, 29 Nov 2018 02:54:45 +0000 (02:54 +0000)]
Move a bunch of flonum tests to test-flonum.scm.
Let's keep test-arith.scm for higher-level numerical computations.
Taylor R Campbell [Thu, 29 Nov 2018 02:43:50 +0000 (02:43 +0000)]
Make the signature of define-enumerated-test match everyone else.
Not sure why I used vectors here in the first place.
Taylor R Campbell [Thu, 29 Nov 2018 02:12:01 +0000 (02:12 +0000)]
Note string and symbol escape printing bug.
Taylor R Campbell [Thu, 29 Nov 2018 02:11:51 +0000 (02:11 +0000)]
Note local optional parameter bug.
Taylor R Campbell [Thu, 29 Nov 2018 02:11:40 +0000 (02:11 +0000)]
Note magnitude overflow bug.
Taylor R Campbell [Thu, 29 Nov 2018 02:11:21 +0000 (02:11 +0000)]
Note flo:min/max IEEE 754-2008 conformance.
Taylor R Campbell [Thu, 29 Nov 2018 02:10:41 +0000 (02:10 +0000)]
Test more edge cases of rounding operations.
Include the rounding->exact operations too.
Taylor R Campbell [Thu, 29 Nov 2018 02:09:57 +0000 (02:09 +0000)]
Update some release notes on floating-point stuff.
Taylor R Campbell [Thu, 29 Nov 2018 02:05:51 +0000 (02:05 +0000)]
Use fabs(3) for C implementation of FLONUM-ABS.
A conditional based on < doesn't handle NaN correctly.
Taylor R Campbell [Thu, 29 Nov 2018 02:02:22 +0000 (02:02 +0000)]
Our C implementation of flo:abs is busted.
Taylor R Campbell [Thu, 29 Nov 2018 01:59:16 +0000 (01:59 +0000)]
Pass multiple arguments here. No functional change.
Taylor R Campbell [Wed, 28 Nov 2018 19:24:36 +0000 (19:24 +0000)]
New NaN-related and min/max flonum procedures and fixes.
- (flo:qnan) returns a quiet NaN: arithmetic on it quietly returns
another qNaN (usually the same one, unless there are multiple to
choose from) without raising any exception.
- (flo:snan) returns a signalling NaN: arithmetic on it returns
another sNaN (usually the same) and raises an exception, which will
trap if you ask.
- (flo:qnan? f) = (and (flo:nan? f) (flo:nan-quiet? f))
- (flo:snan? f) = (and (flo:nan? f) (not (flo:nan-quiet? f)))
- (flo:min x y) and (flo:max x y) now raise an exception only if at
least one input is a signalling NaN, and traps only if you ask.
These now implement minNum and maxNum of IEEE 754-2008.
- (flo:min-mag x y) and (flo:max-mag x y) return whichever of the
inputs has the smaller magnitude, as in minNumMag and maxNumMag in
IEEE 754-2008.
Taylor R Campbell [Wed, 28 Nov 2018 17:55:03 +0000 (17:55 +0000)]
New primitives for creating and examining NaNs.
- (flo:make-nan negative? quiet? payload)
- (flo:nan-quiet? nan)
- (flo:nan-payload nan)
Taylor R Campbell [Wed, 28 Nov 2018 17:53:31 +0000 (17:53 +0000)]
New CTASSERT macro for compile-time assertions.
Taylor R Campbell [Wed, 28 Nov 2018 17:07:36 +0000 (17:07 +0000)]
Implement flo:safe-zero? and flo:safe=.
Taylor R Campbell [Wed, 28 Nov 2018 16:55:06 +0000 (16:55 +0000)]
Merge these cases again now that the xfails are fixed.
Chris Hanson [Tue, 27 Nov 2018 07:18:35 +0000 (23:18 -0800)]
Implement binary-hash-by-X; some hair to guarantee fixnum result.
Not nearly as fast as the underlying unary hash, but for now that's OK. If need
be we can make it faster.
Chris Hanson [Mon, 26 Nov 2018 07:16:50 +0000 (23:16 -0800)]
Simplify spar-push-body.
Chris Hanson [Mon, 26 Nov 2018 01:09:37 +0000 (17:09 -0800)]
Eliminate unnecessary copy of map-in-order.
Taylor R Campbell [Wed, 28 Nov 2018 09:48:40 +0000 (09:48 +0000)]
Teach LIAR/x86-64 to open-code flo:safe-negative?.
Taylor R Campbell [Wed, 28 Nov 2018 09:19:49 +0000 (09:19 +0000)]
Correctly commute flo:safe>= to flo:safe<=, not to safe:>=.
Until LIAR's RTL code compression was taught to search through
object->float, this code path appears to have been impossible to
exercise.
Taylor R Campbell [Wed, 28 Nov 2018 09:15:45 +0000 (09:15 +0000)]
Teach RTL compression to search through object->float too.
This way it can fold (object->float (constant #x1p+0)) in both
(assign (register #x22) (object->float (constant #x1p+0))
(assign (register #x23) (offset (register 4) (machine-constant 0)))
(assign (register #x24) (object->float (register #x23)))
(jumpc (flonum-pred-2-args flonum-is-greater? (register #x22) (register #x24)) label-3)
and
(assign (register #x21) (offset (register 4) (machine-constant 0)))
(assign (register #x22) (object->float (register #x21)))
(assign (register #x24) (object->float (constant #x1p+0)))
(jumpc (flonum-pred-2-args flonum-is-greater? (register #x22) (register #x24)) label-3)
where previously it could handle only the second one because the
reference appeared in the immediately subsequent instruction.
This exposes a latent bug in the x86-64 code generator, to be fixed
in a subsequent commit.
Taylor R Campbell [Wed, 28 Nov 2018 08:53:20 +0000 (08:53 +0000)]
Taylor R Campbell [Wed, 28 Nov 2018 08:51:28 +0000 (08:51 +0000)]
Delete a rewriting rule that could not possibly have ever matched.
It would have required (object->float (object->float ...)) to appear
in the input, which makes no sense.
Taylor R Campbell [Wed, 28 Nov 2018 08:48:09 +0000 (08:48 +0000)]
Test literal operands to flonum comparators.
This is a failed attempt to trigger a compiler bug that I noticed by
code inspection.
Taylor R Campbell [Wed, 28 Nov 2018 08:47:41 +0000 (08:47 +0000)]
Make thie test actually check something by calling both.
Taylor R Campbell [Wed, 28 Nov 2018 05:33:23 +0000 (05:33 +0000)]
Re-enable invalid-operation traps here and fix the one broken test.
Should maybe add a flo:safe-zero?, or decide that flo:zero? is the
quiet version and (flo:= x 0.) is the signalling one.
Taylor R Campbell [Wed, 28 Nov 2018 05:23:10 +0000 (05:23 +0000)]
Factor out unary->binary predicate conversion.
Taylor R Campbell [Wed, 28 Nov 2018 05:18:21 +0000 (05:18 +0000)]
Add flo:<>, as (or flo:< flo:>) for now.
Taylor R Campbell [Wed, 28 Nov 2018 05:17:34 +0000 (05:17 +0000)]
Test flo:unordered? both ways too.
Taylor R Campbell [Wed, 28 Nov 2018 05:15:41 +0000 (05:15 +0000)]
Test compilation of flonum comparisons both ways.
Taylor R Campbell [Wed, 28 Nov 2018 05:03:39 +0000 (05:03 +0000)]
Run the flonum tests both compiled and interpreted.
Taylor R Campbell [Wed, 28 Nov 2018 04:47:50 +0000 (04:47 +0000)]
These tests now pass on x86-64.
Need to teach i386, svm, and C about this now.
Taylor R Campbell [Wed, 28 Nov 2018 04:45:03 +0000 (04:45 +0000)]
Test compiling in-line calls to the flonum comparators too.
Taylor R Campbell [Wed, 28 Nov 2018 04:43:18 +0000 (04:43 +0000)]
Teach LIAR/x86-64 about ordered vs unordered comparisons.
- Fix miscompilation of ordered comparisons: now the standard
comparison operators raise exceptions, which trap if you ask.
- Open-code the unordered comparisons flo:safe< &c.
Taylor R Campbell [Wed, 28 Nov 2018 03:57:18 +0000 (03:57 +0000)]
Factor out unary->binary predicate conversion.
Taylor R Campbell [Wed, 28 Nov 2018 03:48:20 +0000 (03:48 +0000)]
Explain what commute-flonum-predicate is doing.
Taylor R Campbell [Wed, 28 Nov 2018 03:45:16 +0000 (03:45 +0000)]
Teach rtlgen to open-code flo:safe-negative? too.
Disabled on all machines for now.
Taylor R Campbell [Wed, 28 Nov 2018 03:41:15 +0000 (03:41 +0000)]
Teach rtlgen to open-code safe flonum comparison routines.
Disable on all machines for now.
Taylor R Campbell [Wed, 28 Nov 2018 03:39:49 +0000 (03:39 +0000)]
Teach sf about some flonum primitives worth open-coding.
Taylor R Campbell [Wed, 28 Nov 2018 03:01:22 +0000 (03:01 +0000)]
Fix miscompilation of default optional parameters.
Holdover from days when optional parameters were filled with
unassigned reference traps -- LIAR never got the memo.
Taylor R Campbell [Wed, 28 Nov 2018 02:58:46 +0000 (02:58 +0000)]
Test for miscompilation of optional arguments.
Taylor R Campbell [Wed, 28 Nov 2018 02:19:02 +0000 (02:19 +0000)]
Add some tests for primitive floating-point operations.
Taylor R Campbell [Wed, 28 Nov 2018 02:10:00 +0000 (02:10 +0000)]
Test for exceptions from ordered comparisons.
These are currently broken at least on x86 because the compiler
generates the wrong instructions.
When we switch the compiler to generating the right ones we may need to
adjust the runtime to use flo:safeX in certain places.
Taylor R Campbell [Tue, 27 Nov 2018 02:25:20 +0000 (02:25 +0000)]
Define expect-error as an alias for assert-error.
The difference is in intent: expect-error means something is broken,
and the test signals an error because of a bug; assert-error means
the correct behaviour is to signal an error.
Pass expect-error or expect-failure as procedures, not as symbols
representing them, throughout the test suite.
Now we can find documented bugs by grepping for expect-error and
expect-failure.
Taylor R Campbell [Tue, 27 Nov 2018 02:24:54 +0000 (02:24 +0000)]
Implement random-bytevector!.
Taylor R Campbell [Mon, 26 Nov 2018 03:06:31 +0000 (03:06 +0000)]
Note flo:classify and flo:subnormal?.
Taylor R Campbell [Mon, 26 Nov 2018 03:05:22 +0000 (03:05 +0000)]
Define flo:classify and flo:subnormal?.
Taylor R Campbell [Mon, 26 Nov 2018 03:01:53 +0000 (03:01 +0000)]
Test escapes in symbol notation too.
Taylor R Campbell [Mon, 26 Nov 2018 03:01:09 +0000 (03:01 +0000)]
Escape only the character that needs it.
Taylor R Campbell [Mon, 26 Nov 2018 02:52:31 +0000 (02:52 +0000)]
Read/write invariance is broken for strings with `|'.
Taylor R Campbell [Mon, 26 Nov 2018 01:55:03 +0000 (01:55 +0000)]
Add another screw case.
From my attempt to work around the other one using
er-macro-transformer...
Taylor R Campbell [Mon, 26 Nov 2018 01:53:44 +0000 (01:53 +0000)]
Fix typos. Missed this when committing.
Taylor R Campbell [Mon, 26 Nov 2018 01:21:28 +0000 (01:21 +0000)]
Add test for bug#55090.
Taylor R Campbell [Mon, 26 Nov 2018 01:05:03 +0000 (01:05 +0000)]
Add some test cases for (broken) macro expansion.
Chris Hanson [Sat, 24 Nov 2018 05:56:17 +0000 (21:56 -0800)]
Initial draft of program to grovel over files looking for libraries.
This eliminates the need for the library names to be tied to the filesystem
structure.
The loader still needs to be enhanced to automatically load the registered
libraries. For now this is essentially a no-op.
Taylor R Campbell [Sat, 24 Nov 2018 03:53:29 +0000 (03:53 +0000)]
Default os/interprogram-paste needs to return #f or string.
Chris Hanson [Fri, 23 Nov 2018 00:46:54 +0000 (16:46 -0800)]
Revise unix installation notes to be more specific.
Chris Hanson [Fri, 23 Nov 2018 00:48:20 +0000 (16:48 -0800)]
Explicitly prevent native releases from assuming a scheme exists.
Chris Hanson [Thu, 22 Nov 2018 08:23:53 +0000 (00:23 -0800)]
Arrange for runtime packages to be importable as libraries.
Chris Hanson [Tue, 20 Nov 2018 03:57:38 +0000 (19:57 -0800)]
Pass IS_NATIVE_RELEASE to microcode during configuration.
Chris Hanson [Tue, 20 Nov 2018 03:50:37 +0000 (19:50 -0800)]
Fix create-makefiles.sh to use arch consistently.
Chris Hanson [Tue, 20 Nov 2018 00:33:44 +0000 (16:33 -0800)]
Change configure.ac to gobble up arch from ".native-release-marker".
Taylor R Campbell [Tue, 20 Nov 2018 09:18:03 +0000 (09:18 +0000)]
Use flo:hypot to compute inexact magnitudes with edge caess.
Maybe not the best way but it'll do for now.
Taylor R Campbell [Tue, 20 Nov 2018 09:15:53 +0000 (09:15 +0000)]
Test angles of partly infinite complex numbers.
Taylor R Campbell [Tue, 20 Nov 2018 09:15:20 +0000 (09:15 +0000)]
Teach relerr to return 0 if eqv or 1 if not for zero or inf.
This way we confirm infinite results and the sign of zero.
Fix up some test cases that this broke.
Taylor R Campbell [Tue, 20 Nov 2018 08:48:55 +0000 (08:48 +0000)]
magnitude is busted when both components are infinite.
Taylor R Campbell [Tue, 20 Nov 2018 07:01:43 +0000 (07:01 +0000)]
Fix harmless typo.
Accidentally using base 2 set this bound far lower than it needed to
be, but this branch isn't necessary anyway; it just skips a call to
exp that would have given the same result.
Taylor R Campbell [Tue, 20 Nov 2018 06:55:35 +0000 (06:55 +0000)]
Redo some of the floating-point parameters. Test them.
My initial attempt at these went wrong in various ways, oops.
Taylor R Campbell [Tue, 20 Nov 2018 06:34:54 +0000 (06:34 +0000)]
Fix nonsense error analysis in logit1/2+.
The Sterbenz lemma does not apply here after all, not sure why I
thought it did.
Taylor R Campbell [Tue, 20 Nov 2018 06:34:38 +0000 (06:34 +0000)]
Fix overflow in logistic-1/2.
Taylor R Campbell [Tue, 20 Nov 2018 06:33:18 +0000 (06:33 +0000)]
Test some screw cases for logistic-1/2.
Taylor R Campbell [Mon, 19 Nov 2018 01:40:30 +0000 (01:40 +0000)]
Check all four quadrants of complex asin, acos, atan.
Taylor R Campbell [Sun, 18 Nov 2018 23:06:46 +0000 (23:06 +0000)]
Avoid overflow in sqrt(1 - z^2) with sqrt(1 - z)*sqrt(1 + z) in asin.
Strike off a couple xfails. Others remain because the branch cuts
are busted.
Taylor R Campbell [Mon, 19 Nov 2018 01:07:29 +0000 (01:07 +0000)]
Tweak acos tests to clarify and reduce rounding errors.
Taylor R Campbell [Sun, 18 Nov 2018 22:31:36 +0000 (22:31 +0000)]
Define some more complex trig tests, several currently broken.
Chris Hanson [Mon, 19 Nov 2018 05:01:47 +0000 (21:01 -0800)]
Implement handling of traps under macOS.
Chris Hanson [Mon, 19 Nov 2018 02:45:00 +0000 (18:45 -0800)]
Change .native-release-marker to contain arch.
Chris Hanson [Mon, 19 Nov 2018 02:44:24 +0000 (18:44 -0800)]
Move string-for-primitive to (runtime).
Taylor R Campbell [Sun, 18 Nov 2018 06:32:51 +0000 (06:32 +0000)]
Fix definition of relerr.
The expected magnitude should be, well, the magnitude of the expected
value, not the one we actually computed!
Fortunately it doesn't change the outcome of any of the tests here.
Taylor R Campbell [Sun, 18 Nov 2018 06:20:50 +0000 (06:20 +0000)]
Use complex:1+ and complex:-1+.
No functional change but this makes it less likely that someone might
tweak the argument order, which tend sto matter for preserving things
like signed zeros.
Taylor R Campbell [Sun, 18 Nov 2018 06:18:25 +0000 (06:18 +0000)]
Note corrected atan branch cut.
Taylor R Campbell [Sun, 18 Nov 2018 06:05:10 +0000 (06:05 +0000)]
Some more atan tests for real values.
Taylor R Campbell [Sun, 18 Nov 2018 05:34:23 +0000 (05:34 +0000)]
Invent complex:log1m to get correct branch cut in atan on exact inputs.
Not going to export it for now without further thought, though.
Taylor R Campbell [Sun, 18 Nov 2018 05:17:32 +0000 (05:17 +0000)]
Add some atan tests.
Currently (atan -2i) is broken because of an unfortunate consequence
of exact Scheme arithmetic failing to propagate sign changes through
zero like floating-point does.
Taylor R Campbell [Sun, 18 Nov 2018 04:11:50 +0000 (04:11 +0000)]
Add note about signed zero in complex notation.
Taylor R Campbell [Sun, 18 Nov 2018 04:09:23 +0000 (04:09 +0000)]
Fix printing signed zero imaginary part.
Taylor R Campbell [Sun, 18 Nov 2018 04:04:59 +0000 (04:04 +0000)]
More signed zero screw cases in complex numbers.
Taylor R Campbell [Sun, 18 Nov 2018 04:00:17 +0000 (04:00 +0000)]
Some more cases.
Taylor R Campbell [Sun, 18 Nov 2018 03:58:40 +0000 (03:58 +0000)]
Respect signed zero in complex real part.
Taylor R Campbell [Sun, 18 Nov 2018 03:56:31 +0000 (03:56 +0000)]
Test some complex cases. We lose on signed zero (again).
Taylor R Campbell [Sun, 18 Nov 2018 03:38:52 +0000 (03:38 +0000)]
Add note about <= and >= fix.