Skip to content

Commit

Permalink
add comment about how we round at tie breaking case
Browse files Browse the repository at this point in the history
  • Loading branch information
Janni Yuval committed Dec 1, 2020
1 parent d6a3385 commit bea1f37
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 9 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,7 @@ subroutine f_trunc_32( x )
! bits 23-30 are exponent
! bits 0-22 are the mantissa, least significant bits are 0-7.

!round x down
do ib=0,nt
itemp = ibclr(itemp,ib) ! bit to zero
enddo
Expand All @@ -547,7 +548,7 @@ subroutine f_trunc_32( x )
endif
enddo

if (abs(temp2 -x) < abs(temp-x)) then
if (abs(temp2 -x) < abs(temp-x)) then !tie breaking rule -> round toward zero
x = temp2
else
x = temp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,8 @@ subroutine f_trunc_32( x )
! bits 23-30 are exponent
! bits 0-22 are the mantissa, least significant bits are 0-7.

do ib=0,nt
!round x down
do ib=0,nt
itemp = ibclr(itemp,ib) ! bit to zero
enddo

Expand All @@ -438,7 +439,7 @@ subroutine f_trunc_32( x )
endif
enddo

if (abs(temp2 -x) < abs(temp-x)) then
if (abs(temp2 -x) < abs(temp-x)) then !tie breaking rule -> round toward zero
x = temp2
else
x = temp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,7 @@ subroutine f_trunc_32( x )
! bits 23-30 are exponent
! bits 0-22 are the mantissa, least significant bits are 0-7.

!round x down
do ib=0,nt
itemp = ibclr(itemp,ib) ! bit to zero
enddo
Expand All @@ -547,7 +548,7 @@ subroutine f_trunc_32( x )
endif
enddo

if (abs(temp2 -x) < abs(temp-x)) then
if (abs(temp2 -x) < abs(temp-x)) then !tie breaking rule -> round toward zero
x = temp2
else
x = temp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ subroutine f_trunc_32( x )
! bits 23-30 are exponent
! bits 0-22 are the mantissa, least significant bits are 0-7.

!round x down
do ib=0,nt
itemp = ibclr(itemp,ib) ! bit to zero
enddo
Expand All @@ -438,7 +439,7 @@ subroutine f_trunc_32( x )
endif
enddo

if (abs(temp2 -x) < abs(temp-x)) then
if (abs(temp2 -x) < abs(temp-x)) then !tie breaking rule -> round toward zero
x = temp2
else
x = temp
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,7 @@ subroutine f_trunc_32( x )
! bits 23-30 are exponent
! bits 0-22 are the mantissa, least significant bits are 0-7.

!round x down
do ib=0,nt
itemp = ibclr(itemp,ib) ! bit to zero
enddo
Expand All @@ -547,7 +548,7 @@ subroutine f_trunc_32( x )
endif
enddo

if (abs(temp2 -x) < abs(temp-x)) then
if (abs(temp2 -x) < abs(temp-x)) then !tie breaking rule -> round toward zero
x = temp2
else
x = temp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ subroutine f_trunc_32( x )
! bits 23-30 are exponent
! bits 0-22 are the mantissa, least significant bits are 0-7.

!round x down
do ib=0,nt
itemp = ibclr(itemp,ib) ! bit to zero
enddo
Expand All @@ -438,7 +439,7 @@ subroutine f_trunc_32( x )
endif
enddo

if (abs(temp2 -x) < abs(temp-x)) then
if (abs(temp2 -x) < abs(temp-x)) then !tie breaking rule -> round toward zero
x = temp2
else
x = temp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,7 @@ subroutine f_trunc_32( x )
! bits 23-30 are exponent
! bits 0-22 are the mantissa, least significant bits are 0-7.

!round x down
do ib=0,nt
itemp = ibclr(itemp,ib) ! bit to zero
enddo
Expand All @@ -547,7 +548,7 @@ subroutine f_trunc_32( x )
endif
enddo

if (abs(temp2 -x) < abs(temp-x)) then
if (abs(temp2 -x) < abs(temp-x)) then !tie breaking rule -> round toward zero
x = temp2
else
x = temp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ subroutine f_trunc_32( x )
! bits 23-30 are exponent
! bits 0-22 are the mantissa, least significant bits are 0-7.

!round x down
do ib=0,nt
itemp = ibclr(itemp,ib) ! bit to zero
enddo
Expand All @@ -438,7 +439,7 @@ subroutine f_trunc_32( x )
endif
enddo

if (abs(temp2 -x) < abs(temp-x)) then
if (abs(temp2 -x) < abs(temp-x)) then !tie breaking rule -> round toward zero
x = temp2
else
x = temp
Expand Down

0 comments on commit bea1f37

Please sign in to comment.