Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.arch.embedded > #20091

Re: two fpu compared

From Hans-Bernhard Bröker <HBBroeker@t-online.de>
Newsgroups comp.arch.embedded
Subject Re: two fpu compared
Date 2015-02-14 23:28 +0100
Message-ID <cka0hdF4576U1@mid.dfncis.de> (permalink)
References <ck36l8Fak5nU1@mid.individual.net> <mbht2f$v21$1@dont-email.me> <ck6f5eF66ovU1@mid.individual.net> <mbnpm6$m03$1@speranza.aioe.org> <mboe3j$io$1@dont-email.me>

Show all headers | View raw


Am 14.02.2015 um 22:19 schrieb Dimiter_Popoff:
> On 14.2.2015 г. 17:30, glen herrmannsfeldt wrote:

>> (There is only one question left, and that is the way division
>> works when one operand is negative.)
>
> Why is that, what pitfalls do you envisage?

That would be those regarding the expected result of such operations.

To name but the simplest case, there are opposing, but roughly equally 
valid lines of reasoning about what the result of (-5)/3 should be: -2 
or -1.  One keeps the remainder positive and yields a curve for x/3 
without a "kink" as x passes zero.  The other allows independent 
treatment of the operands' signs, i.e. it guarantees (-a)/b = -(a/b).

Negative divisors have a similar issue, with different arguments being 
brought forth.

As is to be expected in such a case, not just MCUs, but also 
higher-level programming languages disagree on these issues.  Some 
language definitions opted not to specify them at all.

This means that the same calculation, even though it's just basic 
operations, and in integers, just by being run in different programming 
languages can easily yield different results.  And sometimes just 
picking a different toolchain for the same language will change the 
outcome ... or a compiler option, or a change to the execution 
environment at runtime, by other code, will.

For floating point operations, these same issues exist under the topic 
name of "rounding modes", and the applicable IEEE 754, 754 and IEC 60559 
standard require support for several of them, plus the ability two 
switch between them at run-time.  For integer divisional rounding, we're 
usually not that lucky: the MCU vendor or HLL specification decide for 
us, and they decide once and for all.

Back to comp.arch.embedded | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

two fpu compared al.basili@gmail.com (alb) - 2015-02-12 08:30 +0000
  Re: two fpu compared David Brown <david.brown@hesbynett.no> - 2015-02-12 10:51 +0100
    Re: two fpu compared al.basili@gmail.com (alb) - 2015-02-13 14:14 +0000
      Re: two fpu compared David Brown <david.brown@hesbynett.no> - 2015-02-13 16:23 +0100
        Re: two fpu compared Colin Paul de Gloucester <not_a_real_email@address.com> - 2015-02-13 17:37 +0100
          Re: two fpu compared al.basili@gmail.com (alb) - 2015-02-16 08:01 +0000
            Re: two fpu compared Colin Paul de Gloucester <not_a_real_email@address.com> - 2015-02-16 11:43 +0100
              Re: two fpu compared al.basili@gmail.com (alb) - 2015-02-17 10:35 +0000
                Re: two fpu compared David Brown <david.brown@hesbynett.no> - 2015-02-17 12:18 +0100
                Re: two fpu compared George Neuner <gneuner2@comcast.net> - 2015-02-17 09:26 -0500
                Re: two fpu compared David Brown <david.brown@hesbynett.no> - 2015-02-17 16:47 +0100
                Re: two fpu compared Dimiter_Popoff <dp@tgi-sci.com> - 2015-02-17 20:54 +0200
        Re: two fpu compared al.basili@gmail.com (alb) - 2015-02-16 07:58 +0000
          Re: two fpu compared David Brown <david.brown@hesbynett.no> - 2015-02-16 09:53 +0100
            Re: two fpu compared al.basili@gmail.com (alb) - 2015-02-16 09:47 +0000
              Re: two fpu compared Richard Damon <Richard@Damon-Family.org> - 2015-02-16 08:27 -0500
        Re: two fpu compared Nobody <nobody@nowhere.invalid> - 2015-02-23 00:13 +0000
      Re: two fpu compared George Neuner <gneuner2@comcast.net> - 2015-02-13 18:43 -0500
      Re: two fpu compared glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-02-14 15:30 +0000
        Re: two fpu compared Dimiter_Popoff <dp@tgi-sci.com> - 2015-02-14 23:19 +0200
          Re: two fpu compared Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2015-02-14 23:28 +0100
          Re: two fpu compared glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-02-15 14:33 +0000
            Re: two fpu compared Dimiter_Popoff <dp@tgi-sci.com> - 2015-02-17 20:53 +0200
              Re: two fpu compared glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-02-18 01:55 +0000
                Re: two fpu compared Dimiter_Popoff <dp@tgi-sci.com> - 2015-02-18 17:54 +0200
                Re: two fpu compared glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-02-18 16:52 +0000
                Re: two fpu compared Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2015-02-18 18:12 +0100
                Re: two fpu compared Robert Wessel <robertwessel2@yahoo.com> - 2015-02-18 18:02 -0600
                Re: two fpu compared Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2015-02-19 09:42 +0200
                Re: two fpu compared Robert Wessel <robertwessel2@yahoo.com> - 2015-02-19 11:04 -0600
                Re: two fpu compared Reinhardt Behm <rbehm@hushmail.com> - 2015-02-19 23:26 +0800
                Re: two fpu compared Dimiter_Popoff <dp@tgi-sci.com> - 2015-02-18 19:18 +0200
                Re: two fpu compared Dimiter_Popoff <dp@tgi-sci.com> - 2015-02-19 02:28 +0200
                Re: two fpu compared glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-02-19 16:29 +0000
                Re: two fpu compared Dimiter_Popoff <dp@tgi-sci.com> - 2015-02-21 16:07 +0200
  Re: two fpu compared glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-02-12 11:26 +0000
  Re: two fpu compared "Boudewijn Dijkstra" <sp4mtr4p.boudewijn@indes.com> - 2015-02-12 12:29 +0100
  Re: two fpu compared Dennis <dennis@none.none> - 2015-02-12 09:45 -0600

csiph-web