Thanks! I feel sheepish for not seeing that earlier.
Looking at the package, I am curious to know why Fixed32 does not have a
dynamic storage type as UFixed does?
I guess it would be possible to add code so that
Fixed32{2}(1)+Fixed32{4}(1) would work; is that right?
Also, I guess that Fixed32 stores each value in 32 bits, regardless of the
parameter f; is that right? Is there a specific use case which caused you
to use Int32 instead of In64?
Thanks!
On Sat, Mar 14, 2015 at 6:34 PM, Tim Holy <[email protected]> wrote:
> If you mean a fixed point number, you might want to check out
> FixedPointNumbers.jl.
>
> --Tim
>
> On Saturday, March 14, 2015 06:28:00 PM Christian Peel wrote:
> > I've been toying around with implementing a fixed-point type in Julia.
> > This has been mentioned before (http://bit.ly/1DlF2S0) I guess that it
> is
> > on one or more person's to-do list; does anyone have a fixed-point type
> > they can share?
> >
> > I made a toy type at this gist:
> > https://gist.github.com/christianpeel/4f630b98fe133b6df690 This type
> sets
> > the number of fractional bits globally and always uses Int64 for the
> > underlying data. I haven't found a clean way to set the type of the
> > underlying data to an aribitrary integer type (see the second file in the
> > gist for one really ugly workaround). One thing that I kept wanting to
> > do was to somehow pass the type for the underlying in, but the following
> > code isn't allowed. Is there anyway to pass a datatype into a
> constructor?
> >
> > immutable FixedP{T<:Integer} <: Real
> > num::T
> > FixedP(num::FloatingPoint,T::DataType) =
> new(convert(T,num*2.0^FPEXP));
> > end
>
>
--
[email protected]