Subversion Repositories wimsdev

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2071 zjchen 1
!goto $wims_read_parm
2
 
3
:def
4
title=Angle convertion
5
synonyme=angle
6
input=function
7
!exit
8
 
9
:proc
10
formula=!item 1 of $formula
11
option=!lower $option
12
option=!word -1 of $option
13
!default option=degree
14
!if $option notwordof radian radians degree degrees
15
 error=bad_formula
16
 !exit
17
!endif
18
 
19
!if $option iswordof degree degrees
20
 o1=rad
21
 o2=deg
22
 t1=$formula
23
 t2=a*180/pi
24
 prest=c=abs(b); d=sign(b); v=floor(c); m=(c-v)*60; M=floor(m); s=round((m-M)*60); print(d*v,",",M,",",s);
25
!else
26
 o1=deg
27
 o2=rad
28
 t1=$formula*pi/180
29
 t2=a
30
 prest=print(($formula)/180);
31
!endif
32
 
33
result=!exec pari a=$t1; b=$t2; print($formula);\
34
	print(b);\
35
	$prest
36
!distribute lines $result into l1, l2, l3
37
!if $l3=$empty or NaN isin $[$l2]
38
 result=
39
!endif
40
!exit
41
 
42
:output
43
!set name_rad=radians
44
!set name_deg=degrees
45
 
46
!htmlmath $l1 
47
 $(name_$o1) = 
48
!htmlmath $l2
49
 $(name_$o2)
50
!if $o2=rad
51
 !if $l2!=0
52
  <p> =
53
  !if / isin $l3
54
   !set l3=($l3)
55
  !endif
56
  !htmlmath $l3*pi
57
 !endif
58
!else
59
 !distribute items $l3 into d,m,s
60
 !ifval ($m!=0 or $s!=0) and $s<60
61
  <p> =
62
  !htmlmath $d
63
  &deg; $m' $s''
64
 !endif
65
!endif
66
 
67
!exit
68