Bug converting numbers?

From: Markus Mottl (mottl@miss.wu-wien.ac.at)
Date: Sat Sep 12 1998 - 15:22:12 MET DST


From: Markus Mottl <mottl@miss.wu-wien.ac.at>
Message-Id: <199809121222.OAA29992@miss.wu-wien.ac.at>
Subject: Bug converting numbers?
To: caml-list@inria.fr (OCAML)
Date: Sat, 12 Sep 1998 14:22:12 +0100 (MET DST)

Hello - Bonjour!

I have encountered unexpected behaviour converting integers to floats:

# let x = 7.;;
val x : float = 7
# let y = float 7;;
val y : float = 7
# x == y;;
- : bool = false

The internal representation of "7." is obviously different to "float 7".
Is there some reason to it? This makes it hard to write things like:

if a_float == float (truncate a_float) ...

if one wants to check whether a float can actually be represented as
an integer...

français:
La représentation de "7." et évidemment differente de "float 7".
Est-ce qu'il y a une raison? C'est un problème si on veut verifier si un
"float" peut être représenté comme "int"...

Regards,
Markus Mottl

-- 
*  Markus Mottl              |  University of Economics and       *
*  Department of Applied     |  Business Administration           *
*  Computer Science          |  Vienna, Austria                   *
*  mottl@miss.wu-wien.ac.at  |  http://miss.wu-wien.ac.at/~mottl  *



This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:15 MET