Prof. Dr. Johannes Grabmeier wrote:
> 
> here it is:
> 
> )abbrev package MPFL MappingPackageFloat
> 
> ++ Author: Johannes Grabmeier
> ++ Date Created: 29.09.2014
> ++ Date Last Updated:
> ++ Description:
> ++   Tools for domain and range modification for the various
> ++   floating point types.
> 
> MappingPackageFloat() : with
>   coerce : (Float -> Float) -> (DoubleFloat -> DoubleFloat)
>   coerce : (DoubleFloat -> DoubleFloat) -> (Float -> Float)
>     ++
>  == add
>   coerce(f: Float -> Float): (DoubleFloat -> DoubleFloat) ==
>     (x : DoubleFloat) : DoubleFloat +-> 
> convert(f(convert(x)@Float))@DoubleFloat
>   coerce(g: DoubleFloat -> DoubleFloat): (Float -> Float) ==
>     (y : Float) : Float +-> convert(g(convert(y)@DoubleFloat))@Float
> 
> however, the internal mechanisms from EXP INT to DoubleFloat -> DoubleFloa
> , seem to allow the interpreter to use this coercion, I guess this package
> has to be used somewhere in the code for Liouvillian functions directly

There are two problems with the above.  First, before using Float
version one should set appropriate precision.  Second, interpreter
will automatically find the new functions only if package name
starts with 'DoubleFloat' (of course, we could stash them in
'DoubleFloat' but 'DoubleFloat' is getting big).

Below is package that seem to work:

)abbrev package DFSFUN2 DoubleFloatSpecialFunctions2
DoubleFloatSpecialFunctions2() : with
    erf : DoubleFloat -> DoubleFloat
    erfi : DoubleFloat -> DoubleFloat
    fresnelC : DoubleFloat -> DoubleFloat
    fresnelS : DoubleFloat -> DoubleFloat
    Ei : DoubleFloat -> DoubleFloat
    li : DoubleFloat -> DoubleFloat
    Ci : DoubleFloat -> DoubleFloat
    Si : DoubleFloat -> DoubleFloat
    Chi : DoubleFloat -> DoubleFloat
    Shi : DoubleFloat -> DoubleFloat
    
  == add

    import FloatLiouvilianFunctions

    to_sf(x) ==>
        obits := bits()$Float
        try
            bits(68)
            convert(x)@DoubleFloat
        finally
            bits(obits)

    bfx ==> convert(x)@Float

    erf(x : DoubleFloat) ==
        to_sf(erf(bfx))

    erfi(x : DoubleFloat) ==
        to_sf(erfi(bfx))

    fresnelC(x : DoubleFloat) ==
        to_sf(fresnelC(bfx))

    fresnelS(x : DoubleFloat) ==
        to_sf(fresnelS(bfx))

    Ei(x : DoubleFloat) ==
        to_sf(Ei(bfx))

    li(x : DoubleFloat) ==
        to_sf(li(bfx))

    Ci(x : DoubleFloat) ==
        to_sf(Ci(bfx))

    Si(x : DoubleFloat) ==
        to_sf(Si(bfx))

    Chi(x : DoubleFloat) ==
        to_sf(Chi(bfx))

    Shi(x : DoubleFloat) ==
        to_sf(Shi(bfx))

-- 
                              Waldek Hebisch
hebi...@math.uni.wroc.pl 

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to fricas-devel+unsubscr...@googlegroups.com.
To post to this group, send email to fricas-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to