Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Need for a built in round_to_int function
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ 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 <> 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

My proposal leaves int_of_float just as it is and defines a new

    val round_to_int : float -> int

which expand to a FISTPL instruction and one or two glue 

  Erik de Castro Lopo (Yes it's valid)
Good advice for everyone : stay away from churches, mosques and