Browse thread
Need for a built in round_to_int function
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Erik de Castro Lopo <ocaml-erikd@m...> |
| Subject: | Re: [Caml-list] Need for a built in round_to_int function |
On Sun, 20 Feb 2005 20:34:14 -0800
Robert Roessler <roessler@rftp.com> wrote:
> Actually, emulating the VC7 "/QIfist" does NOT cause "all int_to_float
> to behave like a round instead of a truncate" - it does exactly what
> we are already talking about: do the int_of_float with a "bare"
> FIST[P], operating in whatever rounding mode the hardware is already
> in (presumably one we want and expect it to be in).
Implementing your proposal, means that int_of_float will change
behaviour depending on a compiler flag. I think thats a bad
idea.
My proposal leaves int_of_float just as it is and defines a new
function:
val round_to_int : float -> int
which expand to a FISTPL instruction and one or two glue
instructions.
Erik
--
+-----------------------------------------------------------+
Erik de Castro Lopo nospam@mega-nerd.com (Yes it's valid)
+-----------------------------------------------------------+
Good advice for everyone : stay away from churches, mosques and
synagouges.