Raymond Toy pushed to branch issue-456-more-accurate-complex-div at cmucl / cmucl

Commits:

1 changed file:

Changes:

  • tests/float.lisp
    ... ... @@ -375,65 +375,65 @@
    375 375
     	 (complex 1d0 (scale-float 1d0 1023))
    
    376 376
     	 (complex (scale-float 1d0 -1023)
    
    377 377
     		  (scale-float -1d0 -1023))
    
    378
    -	 53 least-positive-double-float)
    
    378
    +	 53)
    
    379 379
        ;; 2
    
    380 380
        (list (complex 1d0 1d0)
    
    381 381
     	 (complex (scale-float 1d0 -1023) (scale-float 1d0 -1023))
    
    382 382
     	 (complex (scale-float 1d0 1023) 0)
    
    383
    -	 53 least-positive-double-float)
    
    383
    +	 53)
    
    384 384
        ;; 3
    
    385 385
        (list (complex (scale-float 1d0 1023) (scale-float 1d0 -1023))
    
    386 386
     	 (complex (scale-float 1d0 677) (scale-float 1d0 -677))
    
    387 387
     	 (complex (scale-float 1d0 346) (scale-float -1d0 -1008))
    
    388
    -	 53 least-positive-double-float)
    
    388
    +	 53)
    
    389 389
        ;; 4
    
    390 390
        (list (complex (scale-float 1d0 1023) (scale-float 1d0 1023))
    
    391 391
     	 (complex 1d0 1d0)
    
    392 392
     	 (complex (scale-float 1d0 1023) 0)
    
    393
    -	 53 least-positive-double-float)
    
    393
    +	 53)
    
    394 394
        ;; 5
    
    395 395
        (list (complex (scale-float 1d0 1020) (scale-float 1d0 -844))
    
    396 396
     	 (complex (scale-float 1d0 656) (scale-float 1d0 -780))
    
    397 397
     	 (complex (scale-float 1d0 364) (scale-float -1d0 -1072))
    
    398
    -	 53 least-positive-double-float)
    
    398
    +	 53)
    
    399 399
        ;; 6
    
    400 400
        (list (complex (scale-float 1d0 -71) (scale-float 1d0 1021))
    
    401 401
     	 (complex (scale-float 1d0 1001) (scale-float 1d0 -323))
    
    402 402
     	 (complex (scale-float 1d0 -1072) (scale-float 1d0 20))
    
    403
    -	 53 least-positive-double-float)
    
    403
    +	 53)
    
    404 404
        ;; 7
    
    405 405
        (list (complex (scale-float 1d0 -347) (scale-float 1d0 -54))
    
    406 406
     	 (complex (scale-float 1d0 -1037) (scale-float 1d0 -1058))
    
    407 407
     	 (complex 3.898125604559113300d289 8.174961907852353577d295)
    
    408
    -	 53 least-positive-double-float)
    
    408
    +	 53)
    
    409 409
        ;; 8
    
    410 410
        (list (complex (scale-float 1d0 -1074) (scale-float 1d0 -1074))
    
    411 411
     	 (complex (scale-float 1d0 -1073) (scale-float 1d0 -1074))
    
    412 412
     	 (complex 0.6d0 0.2d0)
    
    413
    -	 53 least-positive-double-float)
    
    413
    +	 53)
    
    414 414
        ;; 9
    
    415 415
        (list (complex (scale-float 1d0 1015) (scale-float 1d0 -989))
    
    416 416
     	 (complex (scale-float 1d0 1023) (scale-float 1d0 1023))
    
    417 417
     	 (complex 0.001953125d0 -0.001953125d0)
    
    418
    -	 53 least-positive-double-float)
    
    418
    +	 53)
    
    419 419
        ;; 10
    
    420 420
        (list (complex (scale-float 1d0 -622) (scale-float 1d0 -1071))
    
    421 421
     	 (complex (scale-float 1d0 -343) (scale-float 1d0 -798))
    
    422 422
     	 (complex 1.02951151789360578d-84 6.97145987515076231d-220)
    
    423
    -	 53 least-positive-double-float)
    
    423
    +	 53)
    
    424 424
        ;; 11
    
    425 425
        ;; From Maxima
    
    426 426
        (list #c(5.43d-10 1.13d-100)
    
    427 427
     	 #c(1.2d-311 5.7d-312)
    
    428 428
     	 #c(3.691993880674614517999740937026568563794896024143749539711267954d301
    
    429 429
     	    -1.753697093319947872394996242210428954266103103602859195409591583d301)
    
    430
    -	 52 least-positive-double-float)
    
    430
    +	 52)
    
    431 431
        ;; 12
    
    432 432
        ;; Found by ansi tests. z/z should be exactly 1.
    
    433 433
        (list #c(1.565640716292489d19 0.0d0)
    
    434 434
     	 #c(1.565640716292489d19 0.0d0)
    
    435 435
     	 #c(1d0 0)
    
    436
    -	 53 least-positive-double-float)
    
    436
    +	 53)
    
    437 437
        ;; 13
    
    438 438
        ;; Iteration 1.  Without this, we would instead return
    
    439 439
        ;;
    
    ... ... @@ -443,25 +443,25 @@
    443 443
        (list (complex (parse-%a "0x1.73a3dac1d2f1fp+509") (parse-%a "-0x1.c4dba4ba1ee79p-620"))
    
    444 444
     	 (complex (parse-%a "0x1.adf526c249cf0p+353") (parse-%a "0x1.98b3fbc1677bbp-697"))
    
    445 445
     	 (complex (parse-%a "0x1.BA8DF8075BCEEp+155") (parse-%a "-0x1.A4AD628DA5B74p-895"))
    
    446
    -	 53 least-positive-double-float)
    
    446
    +	 53)
    
    447 447
        ;; 14
    
    448 448
        ;; Iteration 2.
    
    449 449
        (list (complex (parse-%a "-0x0.000000008e4f8p-1022") (parse-%a "0x0.0000060366ba7p-1022"))
    
    450 450
     	 (complex (parse-%a "-0x1.605b467369526p-245") (parse-%a "0x1.417bd33105808p-256"))
    
    451 451
     	 (complex (parse-%a "0x1.cde593daa4ffep-810") (parse-%a "-0x1.179b9a63df6d3p-799"))
    
    452
    -	 52 least-positive-double-float)
    
    452
    +	 52)
    
    453 453
        ;; 15
    
    454 454
        ;; Iteration 3
    
    455 455
        (list (complex (parse-%a "0x1.cb27eece7c585p-355 ") (parse-%a "0x0.000000223b8a8p-1022"))
    
    456 456
     	 (complex (parse-%a "-0x1.74e7ed2b9189fp-22") (parse-%a "0x1.3d80439e9a119p-731"))
    
    457 457
     	 (complex (parse-%a "-0x1.3b35ed806ae5ap-333") (parse-%a "-0x0.05e01bcbfd9f6p-1022"))
    
    458
    -	 53 least-positive-double-float)
    
    458
    +	 53)
    
    459 459
        ;; 16
    
    460 460
        ;; Iteration 4
    
    461 461
        (list (complex (parse-%a "-0x1.f5c75c69829f0p-530") (parse-%a "-0x1.e73b1fde6b909p+316"))
    
    462 462
     	 (complex (parse-%a "-0x1.ff96c3957742bp+1023") (parse-%a "0x1.5bd78c9335899p+1021"))
    
    463 463
     	 (complex (parse-%a "-0x1.423c6ce00c73bp-710") (parse-%a "0x1.d9edcf45bcb0ep-708"))
    
    464
    -	 52 least-positive-double-float)
    
    464
    +	 52)
    
    465 465
        ))
    
    466 466
     
    
    467 467
     ;; Relative error in terms of bits of accuracy.  This is the
    
    ... ... @@ -482,12 +482,10 @@
    482 482
       (loop for k from 1
    
    483 483
     	for test in *test-cases*
    
    484 484
     	do
    
    485
    -	   (destructuring-bind (x y z-true expected-rel max-ulp)
    
    485
    +	   (destructuring-bind (x y z-true expected-rel)
    
    486 486
     	       test
    
    487 487
     	     (let* ((z (/ x y))
    
    488
    -		    (diff (- z z-true))
    
    489 488
     		    (rel (rel-err z z-true)))
    
    490
    -	       
    
    491 489
     	       (assert-equal expected-rel
    
    492 490
     			     rel
    
    493 491
     			     k x y z z-true diff rel)))))