Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Markus Mottl <mottl@miss.wu-wien.ac.at>
To: caml-list@inria.fr (OCAML)
Subject: Bug converting numbers?
Date: Sat, 12 Sep 1998 14:22:12 +0100 (MET DST)	[thread overview]
Message-ID: <199809121222.OAA29992@miss.wu-wien.ac.at> (raw)

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  *





             reply	other threads:[~1998-09-14  7:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-09-12 13:22 Markus Mottl [this message]
1998-09-14  7:41 ` Pierre Weis
1998-09-14 10:13   ` Markus Mottl

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=199809121222.OAA29992@miss.wu-wien.ac.at \
    --to=mottl@miss.wu-wien.ac.at \
    --cc=caml-list@inria.fr \
    /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