Have you tried Julia's promotion mechanism?  This has worked well for me in
the past, although there may be a slight performance penalty... I can't
comment on that.

http://docs.julialang.org/en/release-0.4/manual/conversion-and-promotion/#promotion

On Tue, Dec 1, 2015 at 11:54 AM, Jeffrey Sarnoff <[email protected]>
wrote:

> I am working on a module that uses bounded intervals.  It would be great
> if the result were easy to use with other's packaged floating-point based
> or Real derived types.
> They work like stretchy Float64s, and support arith, exp, log,
> [a]trig[h], and cdf+pdf+quantile for univariate continuous distributions.
>
>
> Is there any type hierarchy modification with some generalized code that
> would make "conversion to __ not found" happen less when using
> this as if it were Float64 with others' floating point based types that
> are not dependant on sizeof()?
>
> ```julia
>
> abstract EnhancedFloat <: Real abstract AnyFlexFloat <: EnhancedFloat #  
> FlexFloat
> is a (lo,hi) bounded interval # either or both bounds may be Closed(Cl)
> or Open(Op) # e.g. ClOp(lo,hi) is a ClOpen interval.
> abstract OpOp <: AnyFlexFloat abstract ClOp <: AnyFlexFloat abstract OpCl
> <: AnyFlexFloat abstract ClCl <: AnyFlexFloat typealias WorkFlex
> AnyFlexFloat; # was Union{ClCl,ClOp,OpCl,OpOp} typealias WorkFloat
> Union{Float64,Float32}; immutable FlexFloat{T<:WorkFlex, F<:WorkFloat} # <:
> Real does not seem to help much lo::F hi::F end ```
>

Reply via email to