public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Hillel (Sabba) Markowitz" <sabbahem@bcpl.net>
To: GCC Help <gcc-help@gcc.gnu.org>
Cc: c.law@elec.gla.ac.uk
Subject: RE: Casting and Optimization Flags
Date: Wed, 11 Dec 2002 09:06:00 -0000	[thread overview]
Message-ID: <3E0B0CEE@webmail.bcpl.net> (raw)

-------------------- Original Message ----------------------------------
From: Colin Law <c dot law at elec dot gla dot ac dot uk>
     To: Rob Shearer <Rob dot Shearer at networkinference dot com>, eljay at 
adobe dot com
     Cc: gcc-help at gcc dot gnu dot org
     Date: Wed, 11 Dec 2002 13:39:38 +0000
     Subject: Re: Casting and Optimization Flags
     References: 
<3BE4D3F0FB726240966DEF40418472B502EC6F@NI-LON-SERVER1.ad.networkinference.com
>





        casting floats to integers does not round; it truncates

Thanks for the replies. Why was this behaviour more (only!) obvious when I 
used the compiler optimization flags? Had I not tried this, I would be quite 
oblivious to the problem, which could have been very
difficult to track down futher down the line.

Thanks for the bit twiddling hack link Eljay, some of these will do exactly 
what I'm looking for.

~Colin.
---------------------- End Original Message --------------------------------

On some platforms there is a difference in accuracy between the memory and the 
register arithmetic for floating point numbers.  When you ran without 
optimization, the values were stored in memory along the way.  Under 
optimization, they happened to jus be kept in registers with enough of a 
difference to trigger the error that you saw.

-- 
Said the fox to the fish, "Join me ashore".
 The fish are the Jews, Torah is our water

Hillel (Sabba) Markowitz - sabbahem@bcpl.net

             reply	other threads:[~2002-12-11 17:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-11  9:06 Hillel (Sabba) Markowitz [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-12-11  4:43 Rob Shearer
2002-12-11  5:47 ` Colin Law
2002-12-11 11:14 ` Joseph D. Wagner
2002-12-11  4:31 Colin Law
2002-12-11  5:24 ` John Love-Jensen

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=3E0B0CEE@webmail.bcpl.net \
    --to=sabbahem@bcpl.net \
    --cc=c.law@elec.gla.ac.uk \
    --cc=gcc-help@gcc.gnu.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).