• extended bc

    From antonio.macchi.2.7182@gmail.com@21:1/5 to All on Mon Nov 25 04:56:39 2019
    hi, this is my own extended version of linux shell command "bc"
    may be you can find it useful... and may be you can find on it some errors... let me know. bye

    $ cat b

    echo -n "define abs(x){return sqrt(x^2)} "
    echo -n "define cbrt(a){if(a==0)return 0;return e(l(abs(a))/3)*a/abs(a)} "
    echo -n "define qqrt(a){if(a==0)return 0;return e(l(a)/4)} "
    echo -n "define p(a,b){if(a==0){if(b==0)return 1;return 0};return e(l(a)*b)} "
    echo -n "define t(a){return s(a)/c(a)} "
    echo -n "define ct(a){return c(a)/s(a)} "
    echo -n "define as(s){if(s==1)return a(1)*2;if(s==-1)return -a(1)*2;return a(s/sqrt(1-s^2))} "
    echo -n "define ac(c){if(c==1)return 0;if(c==-1)return a(1)*4;if(c==0)return a(1)*2;b_a=a(sqrt(1-c^2)/c);if(b_a>=0)return b_a;return a(1)*4+b_a} "
    echo -n "define act(ct){if(ct==0)return a(1)*2;b_a=a(1/ct);if(b_a>0)return b_a;return a(1)*4+b_a} "
    echo -n "define sec(a){return 1/c(a)} "
    echo -n "define cosec(a){return 1/s(a)} "
    echo -n "define asec(c){return ac(1/c)} "
    echo -n "define acosec(s){return as(1/s)} "
    echo -n "define vers(a){return 1-c(a)} "
    echo -n "define covers(a){return 1-s(a)} "
    echo -n "d