You are not logged in.

#1 2017-04-09 10:26:21

Alaanor
Member
Registered: 2016-01-07
Posts: 51

[Solved] Hms/Dms function in calc: how to use it ?

Hi,

I would like to operate some calculations about DMS/HMS. (Degree/Hour Minute Seconds)

I use the calc package, so in order to discover how to use it (and if it's possible) I do some research in man page.

user@alaanor ~> calc
C-style arbitrary precision calculator (version 2.12.5.3)
Calc is open software. For license details type:  help copyright
[Type "exit" to exit, or "help" for help.]

; help obj

This page explain that some object exist with predefined function, for HMS or DMS the .cal file are stored into /usr/share/calc/[hms/dms].cal

Those files contains only a suit of function and an object prototype declaration.

Hoverer it's doesn't explain me how to use it. >_< So, maybe I'm a bit dumb and I missed something.

; hms
"hms" is undefined

; hms(2, 30, 0)
Function "hms" is undefined

; hms_print(0);
Function "hms_print" is undefined

hms_print is a function declared into /usr/share/calc/hms.cal

Did I misunderstood something ? (I hope)

Last edited by Alaanor (2017-04-09 11:29:15)

Offline

#2 2017-04-09 10:33:19

loqs
Member
Registered: 2014-03-06
Posts: 17,327

Re: [Solved] Hms/Dms function in calc: how to use it ?

$ calc
C-style arbitrary precision calculator (version 2.12.5.3)
Calc is open software. For license details type:  help copyright
[Type "exit" to exit, or "help" for help.]

; read hms
hms(hour,min,sec) defined
hms_add(a,b) defined
hms_neg(a) defined
hms_sub(a,b) defined
hms_mul(a,b) defined
hms_print(a) defined
hms_abs(a) defined
hms_norm(a) defined
hms_test(a) defined
hms_int(a) defined
hms_frac(a) defined
hms_rel(a,b) defined
hms_cmp(a,b) defined
hms_inc(a) defined
hms_dec(a) defined
fixhms(a) defined
obj hms {hour, min, sec} defined
; 

Offline

#3 2017-04-09 10:42:38

Alaanor
Member
Registered: 2016-01-07
Posts: 51

Re: [Solved] Hms/Dms function in calc: how to use it ?

Ho, yeah. It's work.

But you didn't explain how to use it u_u.

You just prove those object are defined.

(Yes, this time I'm a noob è_é)

Last edited by Alaanor (2017-04-09 10:43:20)

Offline

#4 2017-04-09 10:55:10

loqs
Member
Registered: 2014-03-06
Posts: 17,327

Re: [Solved] Hms/Dms function in calc: how to use it ?

$ calc
C-style arbitrary precision calculator (version 2.12.5.3)
Calc is open software. For license details type:  help copyright
[Type "exit" to exit, or "help" for help.]
; read hms
hms(hour,min,sec) defined
hms_add(a,b) defined
hms_neg(a) defined
hms_sub(a,b) defined
hms_mul(a,b) defined
hms_print(a) defined
hms_abs(a) defined
hms_norm(a) defined
hms_test(a) defined
hms_int(a) defined
hms_frac(a) defined
hms_rel(a,b) defined
hms_cmp(a,b) defined
hms_inc(a) defined
hms_dec(a) defined
fixhms(a) defined
obj hms {hour, min, sec} defined
; a=hms(1,2,3)
; b=hms(4,5,6)
; c=hms_add(a,b)
; hms_print(c)
5:7:9;

Have you examined the source /usr/share/calc/hms.cal if you do not know what the functions do?

Offline

#5 2017-04-09 11:24:08

Alaanor
Member
Registered: 2016-01-07
Posts: 51

Re: [Solved] Hms/Dms function in calc: how to use it ?

Hoooo, finally I understand it !

I have to load the module to get function defined each time.

Any way to load all of them automatically at each start ?

Offline

#6 2017-04-09 11:40:13

loqs
Member
Registered: 2014-03-06
Posts: 17,327

Re: [Solved] Hms/Dms function in calc: how to use it ?

$ cat ~/.calcrc
read hms
$ calc
C-style arbitrary precision calculator (version 2.12.5.3)
Calc is open software. For license details type:  help copyright
[Type "exit" to exit, or "help" for help.]

hms(hour,min,sec) defined
hms_add(a,b) defined
hms_neg(a) defined
hms_sub(a,b) defined
hms_mul(a,b) defined
hms_print(a) defined
hms_abs(a) defined
hms_norm(a) defined
hms_test(a) defined
hms_int(a) defined
hms_frac(a) defined
hms_rel(a,b) defined
hms_cmp(a,b) defined
hms_inc(a) defined
hms_dec(a) defined
fixhms(a) defined
obj hms {hour, min, sec} defined
; 

Offline

#7 2017-04-09 12:06:35

Alaanor
Member
Registered: 2016-01-07
Posts: 51

Re: [Solved] Hms/Dms function in calc: how to use it ?

Thanks you for all !

Offline

Board footer

Powered by FluxBB