English
Source / code snippets

Dezimalgrad to +/-Deg°Min'Sec<n Nachkommastellen> and back wandeln

 

p.specht

Dezimalgrad to +/-Deg°Min'Sec<n Nachkommastellen> and back wandeln
(yet not erschöpfend tested, for my tack reichte it!)
Windowtitle "Dezimalgrad to +/-DDD°MM'SS.SSSS"
'EARLY ALPHA, VORSICHT! (D) demonstration 2018-04 P.woodpecker, Wien
Windowstyle 24:cls:set("decimals",15):font 2

Proc DMSc2Deg :parameters d&,m&,s!

    var sgn&=1-2*(d&<0):d&=abs(d&)
    return sgn&*(d&+m&/60+s!/3600)

Endproc

DEF Sgn(1) (@!(1)>0)-(@!(1)<0)
DEF Sg$(1) if(Sgn(@!(1))<0,"-","+")
def Dg°(1) int(int(abs(@!(1))) mod 360)
def Mn°(1) int(abs(int((@!(1)-Dg°(@!(1)))*60)) mod 60)
def Sc°(1) abs(((@!(1)-int(@!(1)))*60)-int((@!(1)-int(@!(1)))*60))*60
DEF Dg$(1) right$("   "+Sg$(@!(1))+st$( Dg°(@!(1)) ),4)+"°"
DEF Mn$(1) right$("00"+st$(Mn°(@!(1))),2)+"'"
DEF Sc$(2) stature$("00."+mkstr$("0",@&(2)),Sc°(x!))'st$(Sc°(@!(1)))

proc Test°

    print if(x!>=0," ","");x!,tab(29);
    print Dg$(x!)+Mn$(x!)+Sc$(x!,4)'<<< 2.Param.: Nachkommastellen,

endproc'... 4 Kommastellen with Sc° = Erdumfang on 3.1 mm very

var \
x!= 1.234567890 : Test°
x!=-1.234567890 : Test°
x!= 1.57 : Test°
x!=-1.57 : Test°
x!= 0.571 : Test°
x!=-0.571 : Test°
x!= 362.57 : Test°
x!=-362.57 : Test°
waitinput 5000:Print "\n\n thanks for testing!":sound 30,50:waitinput 2500
print
print
'experiment: String with Deg°mins'Sec decompose and to Dezimalgrad zurückkonvertieren
declare y!,DMSc$,v1&,v2&,v3&, w$
lup:
Font 2:print " Dezimalgrad: ";:input w$

if w$>"":x!=val(w$): else : x!=y!:endif

    locate %csrlin-1,40
    DMSc$ = Dg$(x!)+Mn$(x!)+Sc$(x!,4)
    print DMSc$
    v1&=InStr("°",DMSc$)
    v2&=InStr("'",DMSc$)
    v3&=InStr(chr $(34),DMSc$):case v3&=0:v3&=len(DMSc$)
    print " ";left$(DMSc$,v1&-1);"°";mid$(DMSc$,v1&+1,v2&-v1&-1);"'";mid$(DMSc$,v2&+1,v3&-v2&)
    font 0
    'Print val(left$(DMSc$,v1&-1)),\
    '      val(mid$(DMSc$,v1&+1,v2&-v1&-1)),\
    '      val(mid$(DMSc$,v2&+1,v3&-v2&))
    Y! = DMSc2Deg(val(left$(DMSc$,v1&-1)),\
    val(mid$(DMSc$,v1&+1,v2&-v1&-1)),\
    val(mid$(DMSc$,v2&+1,v3&-v2&)))
    Print tab(25);y!," Err:",stature$("%g",x!-y!)
    goto "lup"
 
XProfan 11
Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'...
05/27/21  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

1.337 Views

Untitledvor 0 min.
p.specht11/21/21
R.Schneider11/20/21
Uwe Lang11/20/21
Manfred Barei11/19/21
More...

Themeninformationen

this Topic has 1 subscriber:

p.specht (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie