* persistance in zcalc funct defs
@ 2018-05-03 10:38 ` jdh
2018-05-03 11:18 ` Peter Stephenson
0 siblings, 1 reply; 3+ messages in thread
From: jdh @ 2018-05-03 10:38 UTC (permalink / raw)
To: zsh-users
Example I am doing some trigonometry calcuations and am more familiar with using degrees for angles, rather than radians.
Today I learned how do define zcalc functions to ease this
In zcalc I did the below (The constants are for 360/(2*pi) and it's inverse)
..> function dtor $1 * 0.0174533
..> function rtod $1 * 57.2958
When I shut down and reboot on the morrow, I dought that these will persist.
Do I need to, or can I put these functions in a zcalc read/init file ? This syntax will probably not work in the zsh startup files.
What is the recommended way to get functions for zcalc loaded automatically.
Regards
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: persistance in zcalc funct defs
2018-05-03 10:38 ` persistance in zcalc funct defs jdh
@ 2018-05-03 11:18 ` Peter Stephenson
2018-05-03 15:13 ` Ray Andrews
0 siblings, 1 reply; 3+ messages in thread
From: Peter Stephenson @ 2018-05-03 11:18 UTC (permalink / raw)
To: zsh-users
On Thu, 03 May 2018 03:38:01 -0700
"jdh" <dhenman@gmail.com> wrote:
> In zcalc I did the below (The constants are for 360/(2*pi) and it's
> inverse)
>
> ..> function dtor $1 * 0.0174533
> ..> function rtod $1 * 57.2958
>
>
>
> When I shut down and reboot on the morrow, I dought that these will
> persist.
>
> Do I need to, or can I put these functions in a zcalc read/init
> file ? This syntax will probably not work in the zsh startup files.
Just put the following in your .zshrc:
autoload -Uz zmathfuncdef
zmathfuncdef dtor '$1 * 0.0174533'
zmathfuncdef rtod '$1 * 57.2958'
See the zshcontrib manaul.
pws
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: persistance in zcalc funct defs
2018-05-03 11:18 ` Peter Stephenson
@ 2018-05-03 15:13 ` Ray Andrews
0 siblings, 0 replies; 3+ messages in thread
From: Ray Andrews @ 2018-05-03 15:13 UTC (permalink / raw)
To: zsh-users
On 03/05/18 04:18 AM, Peter Stephenson wrote:
> On Thu, 03 May 2018 03:38:01 -0700
> "jdh" <dhenman@gmail.com> wrote:
>> In zcalc I did the below (The constants are for 360/(2*pi) and it's
>> inverse)
>>
>> ..> function dtor $1 * 0.0174533
>> ..> function rtod $1 * 57.2958
>>
What an interesting coincidence, I was doing some trig just last night,
and the conversion from degrees to radians was a minor bother, but a
bother just the same. Could we have the choice? It would seem to be a
very simple thing to add: "setopt ZCALC_DEGREES" "setopt ZCALC_RADIANS"
?? ... and of course the internal math would be trivial, but faster and
more accurate than belaboring it in one's code. 20 minutes work (he
said, with his laughable naivety ;-)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-05-03 15:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CGME20180503103919epcas1p328bce3d32c6c002be49e49e10ff08ced@epcas1p3.samsung.com>
2018-05-03 10:38 ` persistance in zcalc funct defs jdh
2018-05-03 11:18 ` Peter Stephenson
2018-05-03 15:13 ` Ray Andrews
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).