Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* Bug converting numbers?
@ 1998-09-12 13:22 Markus Mottl
  1998-09-14  7:41 ` Pierre Weis
  0 siblings, 1 reply; 3+ messages in thread
From: Markus Mottl @ 1998-09-12 13:22 UTC (permalink / raw)
  To: OCAML

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  *





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1998-09-14  9:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-09-12 13:22 Bug converting numbers? Markus Mottl
1998-09-14  7:41 ` Pierre Weis
1998-09-14 10:13   ` Markus Mottl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox