URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 303 |
Rev 338 |
! Program to test SIGN intrinsic
|
! Program to test SIGN intrinsic
|
program intrinsic_sign
|
program intrinsic_sign
|
implicit none
|
implicit none
|
integer i, j
|
integer i, j
|
real r, s
|
real r, s
|
|
|
i = 2
|
i = 2
|
j = 3
|
j = 3
|
if (sign (i, j) .ne. 2) call abort
|
if (sign (i, j) .ne. 2) call abort
|
i = 4
|
i = 4
|
j = -5
|
j = -5
|
if (sign (i, j) .ne. -4) call abort
|
if (sign (i, j) .ne. -4) call abort
|
i = -6
|
i = -6
|
j = 7
|
j = 7
|
if (sign (i, j) .ne. 6) call abort
|
if (sign (i, j) .ne. 6) call abort
|
i = -8
|
i = -8
|
j = -9
|
j = -9
|
if (sign (i, j) .ne. -8) call abort
|
if (sign (i, j) .ne. -8) call abort
|
r = 1
|
r = 1
|
s = 2
|
s = 2
|
if (sign (r, s) .ne. 1) call abort
|
if (sign (r, s) .ne. 1) call abort
|
r = 1
|
r = 1
|
s = -2
|
s = -2
|
if (sign (r, s) .ne. -1) call abort
|
if (sign (r, s) .ne. -1) call abort
|
s = 0
|
s = 0
|
if (sign (r, s) .ne. 1) call abort
|
if (sign (r, s) .ne. 1) call abort
|
! Will fail on machines which cannot represent negative zero.
|
! Will fail on machines which cannot represent negative zero.
|
s = -s ! Negative zero
|
s = -s ! Negative zero
|
if (sign (r, s) .ne. -1) call abort
|
if (sign (r, s) .ne. -1) call abort
|
end program
|
end program
|
|
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.