Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert-van-Engelen committed Jan 9, 2023
1 parent 40dc62b commit 2317e6a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
5 changes: 4 additions & 1 deletion math.asm
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ normalize: ; normalize bahl to return inexact result bcde with sign' l' bit 7
; FLOATING POINT CONSTANT ZERO
;
; fzero: 0.0 -> bcde
; cf reset
; a,b,c,d,e modified
;
;-------------------------------------------------------------------------------
Expand Down Expand Up @@ -410,6 +411,8 @@ fmul: EXPA ; exponent -> a
ex af,af' ; restore a and cf
jp shiftoncarry ; normalize bahl to return float bcde

; out of range, return zero (underflow, cf reset) or overflow (cf set)

outofrange: add a ; carry if bit 7 set
jr nc,fzero ; if incorrect positive then return zero (underflow, cf reset)
ret ; return with overflow error (cf set)
Expand Down Expand Up @@ -608,7 +611,7 @@ itof: ld a,b ;

; set result exponent b and normalize nonzero mantissa ahl.e

ld b,bias + 31 ; set exponent b
ld b,bias+31 ; set exponent b
or a ;
jp m,finalize ; if a bit 7 not set then
1$: dec b ; 4 ; loop, decrement exponent b (cannot underflow)
Expand Down
8 changes: 4 additions & 4 deletions mathr.asm
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@
; -1 = bf 80 00 00
; -2 = c0 00 00 00
; -3 = c0 40 00 00
; inf = 7f 80 00 00 n/a (invalid value)
; -inf = ff 80 00 00 n/a (invalid value)
; inf = 7f 80 00 00 n/a (invalid value in this version)
; -inf = ff 80 00 00 n/a (invalid value in this version)
; nan = s 11111111 xxxxxxx xxxxxxxx xxxxxxxx at least one x is 1
; n/a (invalid value)
; n/a (invalid value in this version)
;
; IEEE 754 binary floating point allows floating point values to
; be compared as if comparing 32 bit signed integers with 'i<':
Expand Down Expand Up @@ -659,7 +659,7 @@ fdivy: EXPA ; exponent -> a
exx ; activate bcdehl
set 7,c ; set bit 7 of man2 c

; divide mantissas cde' / cde -> chl'
; divide mantissas cde' / cde -> quotient chl' remainder ahl

xor a ;
ld h,a ;
Expand Down
2 changes: 1 addition & 1 deletion mathri.asm
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ fdivy: EXPA ; exponent -> a
exx ; activate bcdehl
set 7,c ; set bit 7 of man2 c

; divide mantissas cde' / cde -> chl'
; divide mantissas cde' / cde -> quotient chl' remainder ahl

xor a ;
ld h,a ;
Expand Down

0 comments on commit 2317e6a

Please sign in to comment.