[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: AFL floating point number representation?



PureBytes Links

Trading Reference Links

Agreed, the fractional portion of the float is easy to manipulate. 

The formula will pack a stock price into 23 bits and a position size
into 8 bits.

There are other ways to get data into the CBT, but this approach will
execute faster than other alternatives.

Cheers,
Steve

--- In amibroker@xxxxxxxxxxxxxxx, Dennis Brown <see3d@xxx> wrote:
>
> How many bits are your numbers?
> 
> Two 11 bit integers can be be packed and unpacked from one 32 bit  
> float number with ease.  You just mask (&) bits to extract the low  
> order number.  Use multiply or divide to shift the low to the high  
> half of the number and back to the low half again.  Simple bit  
> arithmetic.
> 
> Though it seems there should be easier ways to get what you want.  I  
> am not a CBT user though.
> 
> BR,
> Dennis
> 
> 
> On Feb 7, 2009, at 7:57 PM, hydroblue@xxx wrote:
> 
> > Thanks Tomasz. I'm looking for a clever way to stuff two numbers into
> > the 32 bit float and then later extract the 2 numbers.
> >
> > // fraction = 23 bit integer
> > // exponent = 8 bit integer
> >
> > The reason for doing this is to efficiently get an extra array of
> > numbers into the portfolio backtester without thousands of static vars
> > or Foreign symbols.
> >
> > Is there a way to do this in AFL without writing a DLL?
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <groups@>  
> > wrote:
> >>
> >> Hello,
> >>
> >> IEEE 754 Standard floating point (32 bit, single precision)
> >> http://en.wikipedia.org/wiki/IEEE_754-1985
> >>
> >> Best regards,
> >> Tomasz Janeczko
> >> amibroker.com
> >> ----- Original Message -----
> >> From: <hydroblue@>
> >> To: <amibroker@xxxxxxxxxxxxxxx>
> >> Sent: Saturday, February 07, 2009 5:13 PM
> >> Subject: [amibroker] AFL floating point number representation?
> >>
> >>
> >>> I need to know what range of values and what precision can be
> >>> represented in the AFL floating point arrays, specifically the
> >>> PositionSize array.
> >>>
> >>> It would also be useful to know how many bits are available in the
> >>> mantissa and exponent. Any help appreciated.
> >>>
> >>> Thanks,
> >>> Steve
> >>>
> >>>
> >>>
> >>> ------------------------------------
> >>>
> >>> **** IMPORTANT ****
> >>> This group is for the discussion between users only.
> >>> This is *NOT* technical support channel.
> >>>
> >>> *********************
> >>> TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail
> > directly to
> >>> SUPPORT {at} amibroker.com
> >>> *********************
> >>>
> >>> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> >>> http://www.amibroker.com/devlog/
> >>>
> >>> For other support material please check also:
> >>> http://www.amibroker.com/support.html
> >>>
> >>> *********************************
> >>> Yahoo! Groups Links
> >>>
> >>>
> >>>
> >>
> >
> >
> >
> >
> > ------------------------------------
> >
> > **** IMPORTANT ****
> > This group is for the discussion between users only.
> > This is *NOT* technical support channel.
> >
> > *********************
> > TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail  
> > directly to
> > SUPPORT {at} amibroker.com
> > *********************
> >
> > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> > http://www.amibroker.com/devlog/
> >
> > For other support material please check also:
> > http://www.amibroker.com/support.html
> >
> > *********************************
> > Yahoo! Groups Links
> >
> >
> >
>




------------------------------------

**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

*********************
TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com
*********************

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html

*********************************
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/