[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Cast to Real in C++ style throughout (issue 547560044 by address@hid
From: |
dak |
Subject: |
Re: Cast to Real in C++ style throughout (issue 547560044 by address@hidden) |
Date: |
Sun, 02 Feb 2020 11:08:59 -0800 |
On 2020/02/02 18:51:08, Dan Eble wrote:
> LGTM
>
> https://codereview.appspot.com/547560044/diff/555240043/lily/spring.cc
> File lily/spring.cc (right):
>
>
https://codereview.appspot.com/547560044/diff/555240043/lily/spring.cc#newcode119
> lily/spring.cc:119: avg_stretch /= static_cast<Real> (springs.size
());
> This is not an issue with this change, but should this function do
something
> other than divide by zero when springs is empty?
Possibly. We have had a few reports of combinations of forced breaks
leading to failed assertions. Dividing by Real zero (which was done
here before as well due to conversion rules) does not throw
divide-by-zero but results in ±inf.0 (unless the numerator is also zero,
then you get ±nan.0). So I won't rule out that some of the triggering
cases might have come through this code path.
https://codereview.appspot.com/547560044/