File: boz_01.f90

package info (click to toggle)
lfortran 0.58.0-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 54,512 kB
  • sloc: cpp: 162,179; f90: 68,251; python: 17,476; ansic: 6,278; yacc: 2,334; sh: 1,317; fortran: 892; makefile: 33; javascript: 15
file content (24 lines) | stat: -rw-r--r-- 596 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
program boz_01
implicit none

integer :: boz_1, boz_2, boz_3, boz_4, boz_5
real:: boz_6

boz_1 = int(b'01011101')
boz_2 = int(o'2347')
boz_3 = int(z'ABC')
!Testing Truncation of BOZ
boz_4 = int(Z'234567890abcdef1')
boz_5 = int(Z'2234567890abcdef1')
!Checking Real Conversion of BOZ
boz_6 = real(b'01101')
!Check with Integer Equivalent Values
if (boz_4 /= boz_5) error stop
if (boz_1 /= 93) error stop
if (boz_2 /= 1255) error stop
if (boz_3 /= 2748) error stop
if (boz_4 /= 180150001) error stop
if (boz_5 /= 180150001) error stop 

print *, boz_1, boz_2, boz_3, boz_4, boz_5, boz_6
end program