File: intrinsics_212.f90

package info (click to toggle)
lfortran 0.45.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 46,332 kB
  • sloc: cpp: 137,068; f90: 51,260; python: 6,444; ansic: 4,277; yacc: 2,285; fortran: 806; sh: 524; makefile: 30; javascript: 15
file content (86 lines) | stat: -rw-r--r-- 3,413 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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
program intrinsics_212
    use, intrinsic :: iso_fortran_env, only: dp => real64, sp => real32
    integer :: x = 1
    complex(4) :: z4
    complex(8) :: z8

    print*, cabs((1.0, 2.0))
    if (abs(cabs((1.0, 2.0)) - 2.23606798) > 10e-5) error stop
    print*, zabs((1.0_8, 2.0_8))
    if (abs(zabs((1.0_8, 2.0_8)) - 2.23606798_8) > 10e-5) error stop
    print*, cdabs((1.0_8, 2.0_8))
    if (abs(cdabs((1.0_8, 2.0_8)) - 2.23606798_8) > 10e-5) error stop

    print*, csin((1.0, 2.0)) 
    if (abs(csin((1.0, 2.0)) - (3.16577840,1.95960104)) > 10e-5) error stop 
    print*, zsin((1.0_8, 2.0_8)) 
    if (abs(zsin((1.0_8, 2.0_8)) - (3.16577840_8,1.95960104_8)) > 10e-5) error stop 
    print*, cdsin((1.0_8, 2.0_8)) 
    if (abs(cdsin((1.0_8, 2.0_8)) - (3.16577840_8,1.95960104_8)) > 10e-5) error stop

    print*, ccos((1.0, 2.0)) 
    if (abs(ccos((1.0, 2.0)) - (2.03272295,-3.05189776)) > 10e-5) error stop 
    print*, zcos((1.0_8, 2.0_8)) 
    if (abs(zcos((1.0_8, 2.0_8)) - (2.03272295_8,-3.05189776_8)) > 10e-5) error stop 
    print*, cdcos((1.0_8, 2.0_8)) 
    if (abs(cdcos((1.0_8, 2.0_8)) - (2.03272295_8,-3.05189776_8)) > 10e-5) error stop

    print*, csqrt((1.0, 2.0)) 
    if (abs(csqrt((1.0, 2.0)) - (1.27201965,0.78615138)) > 10e-5) error stop 
    print*, zsqrt((1.0_8, 2.0_8)) 
    if (abs(zsqrt((1.0_8, 2.0_8)) - (1.27201965_8,0.78615138_8)) > 10e-5) error stop 
    print*, cdsqrt((1.0_8, 2.0_8)) 
    if (abs(cdsqrt((1.0_8, 2.0_8)) - (1.27201965_8,0.78615138_8)) > 10e-5) error stop

    print*, cexp((1.0, 2.0)) 
    if (abs(cexp((1.0, 2.0)) - (-1.13120438,2.47172667)) > 10e-5) error stop 
    print*, zexp((1.0_8, 2.0_8)) 
    if (abs(zexp((1.0_8, 2.0_8)) - (-1.13120438_8,2.47172667_8)) > 10e-5) error stop 
    print*, cdexp((1.0_8, 2.0_8)) 
    if (abs(cdexp((1.0_8, 2.0_8)) - (-1.13120438_8,2.47172667_8)) > 10e-5) error stop

    print*, xor(1, 1) 
    if (xor(1, 1) /= 0) error stop

    z4 = (1.0, 2.0)
    z8 = (1.0_dp, 2.0_dp)

    print*, cabs(z4)
    if (abs(cabs(z4) - 2.23606798) > 10e-5) error stop
    print*, zabs(z8)
    if (abs(zabs(z8) - 2.23606798_8) > 10e-5) error stop
    print*, cdabs(z8)
    if (abs(cdabs(z8) - 2.23606798_8) > 10e-5) error stop

    print*, csin(z4) 
    if (abs(csin(z4) - (3.16577840,1.95960104)) > 10e-5) error stop 
    print*, zsin(z8) 
    if (abs(zsin(z8) - (3.16577840_8,1.95960104_8)) > 10e-5) error stop 
    print*, cdsin(z8) 
    if (abs(cdsin(z8) - (3.16577840_8,1.95960104_8)) > 10e-5) error stop

    print*, ccos(z4) 
    if (abs(ccos(z4) - (2.03272295,-3.05189776)) > 10e-5) error stop 
    print*, zcos(z8) 
    if (abs(zcos(z8) - (2.03272295_8,-3.05189776_8)) > 10e-5) error stop 
    print*, cdcos(z8) 
    if (abs(cdcos(z8) - (2.03272295_8,-3.05189776_8)) > 10e-5) error stop

    print*, csqrt(z4) 
    if (abs(csqrt(z4) - (1.27201965,0.78615138)) > 10e-5) error stop 
    print*, zsqrt(z8) 
    if (abs(zsqrt(z8) - (1.27201965_8,0.78615138_8)) > 10e-5) error stop 
    print*, cdsqrt(z8) 
    if (abs(cdsqrt(z8) - (1.27201965_8,0.78615138_8)) > 10e-5) error stop

    print*, cexp(z4) 
    if (abs(cexp(z4) - (-1.13120438,2.47172667)) > 10e-5) error stop 
    print*, zexp(z8) 
    if (abs(zexp(z8) - (-1.13120438_8,2.47172667_8)) > 10e-5) error stop 
    print*, cdexp(z8) 
    if (abs(cdexp(z8) - (-1.13120438_8,2.47172667_8)) > 10e-5) error stop

    print*, xor(x, x) 
    if (xor(x, x) /= 0) error stop

end program