From: Niki Yoshiuchi <aplusbi@gmail.com>
To: Eray Ozkural <examachine@gmail.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Fixed-point arithmetic on 32-bit architectures
Date: Wed, 5 Jan 2011 11:34:33 -0500 [thread overview]
Message-ID: <AANLkTimLJma0A+nnuCeSX0sVPXpbiALOtOUN2uzRwNfo@mail.gmail.com> (raw)
In-Reply-To: <AANLkTimdAe+BgseJLinwhF=5oy2Yb8Lui5po=3uQ+EOM@mail.gmail.com>
What range of numbers are you hoping to represent and what operations
are you commonly performing on them? If it's possible for you to
represent your numbers as 24.8 fixed-point (for example) and you are
mostly adding and subtracting, then I would recommend using 32 bit
integers and casting to 64 bit for multiplication and division.
Alternatively you can try and be clever about your shifting instead of
casting (shifting the multiplicand instead of the product, or doing a
half shift on each multiplicand, etc).
On Wed, Jan 5, 2011 at 11:22 AM, Eray Ozkural <examachine@gmail.com> wrote:
> Hello there,
> I'm using fixed-point arithmetic in an algorithm. I am troubled by the
> inefficiency of the fixed-point multiplication and division operations on
> 32-bit architectures. On the Intel 64-bit architecture, I can use the
> Nativeint module and it's quite fast, on 32-bit I had to use the Int64
> module (for the necessary shifts and mul/div's) and I encountered a
> significant slowdown, naturally. is there a preferred way of performing
> fixed point arithmetic with ocaml on 32-bit architectures that I might be
> overlooking?
> Best,
> --
> Eray Ozkural, PhD candidate. Comp. Sci. Dept., Bilkent University, Ankara
> http://groups.yahoo.com/group/ai-philosophy
>
>
next prev parent reply other threads:[~2011-01-05 16:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-05 16:22 Eray Ozkural
2011-01-05 16:34 ` Niki Yoshiuchi [this message]
2011-01-05 18:38 ` Eray Ozkural
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AANLkTimLJma0A+nnuCeSX0sVPXpbiALOtOUN2uzRwNfo@mail.gmail.com \
--to=aplusbi@gmail.com \
--cc=caml-list@inria.fr \
--cc=examachine@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).