Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(6501)

Issue 217720043: Avoid floating-point compares on Stem:head_positions; issue 4310

Can't Edit
Can't Publish+Mail
Start Review
Created:
9 years, 1 month ago by Keith
Modified:
9 years, 1 month ago
Reviewers:
dak, lemzwerg
CC:
lilypond-devel_gnu.org
Visibility:
Public.

Description

Avoid floating-point compares on Stem:head_positions; issue 4310 On the cross-compiled windows executable, head_positions().is_empty() seems to sometimes return true for a stem with a single note. head_positions() returns something like [3.00... , 3.00...]

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+10 lines, -10 lines) Patch
M lily/beam.cc View 1 chunk +4 lines, -4 lines 0 comments Download
M lily/stem.cc View 2 chunks +6 lines, -6 lines 0 comments Download

Messages

Total messages: 6
lemzwerg
LGTM.
9 years, 1 month ago (2015-03-11 05:19:34 UTC) #1
dak
_How_ do we arrive at different versions of 3.0 here, or at GCC considering 3.0 ...
9 years, 1 month ago (2015-03-11 09:10:29 UTC) #2
lemzwerg
Any idea how to find it?
9 years, 1 month ago (2015-03-11 09:40:11 UTC) #3
Keith
On Wed, 11 Mar 2015 02:10:29 -0700, <dak@gnu.org> wrote: > _How_ do we arrive at ...
9 years, 1 month ago (2015-03-11 16:36:44 UTC) #4
dak
On 2015/03/11 16:36:44, Keith wrote: > On Wed, 11 Mar 2015 02:10:29 -0700, <mailto:dak@gnu.org> wrote: ...
9 years, 1 month ago (2015-03-11 18:14:37 UTC) #5
Keith
9 years, 1 month ago (2015-03-12 03:25:20 UTC) #6
On 2015/03/11 18:14:37, dak wrote:
> On 2015/03/11 16:36:44, Keith wrote:
> > I think a standard-conforming implementation should give bit-identical
> > floating-point results for these parallel computations,
> 
> No, not at all.  In C++, any computation may be carried out at any precision
at
> least as high as that of the operands.  Only when the results are stored in a
> variable (or possibly explicitly cast to some fp type) is it guaranteed that
the
> precision is not higher than specified.
> 
> If we indeed do the equivalent of n*x/x, we are no longer guaranteed that
> starting from an integer n we arrive at an integer, and when we do this in two
> separate code paths, one calculation may end up as an integer while another
> doesn't.
> 

Oh.  That's probably it, then.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b