[Rivet] Vector3 floating point precision issue with angles function

Andy Buckley andy.buckley at cern.ch
Wed Dec 17 17:51:31 GMT 2014


Hi Yik Tung,

Thanks for the feedback. We'll look into fixing that in the next
release, either by setting a lower tolerance or by re-engineering it a
bit better. The angle function doesn't get used that much, so hasn't
been "honed". What application do you have which requires such angular
precision, by the way?

Andy


On 14/12/14 14:47, Ho, Yik Tung wrote:
> Hi,
> 
> We have been trying to use Rivet in our work and we have a question
> regarding the Vector3.hh header. I’m new to this and not a developer
> of Rivet itself nor have an account on Hepforge and I can’t seem to
> figure out how to open a ticket, so I’ll ask the question below:
> 
> For the function angle() defined at line 82 in Vector3.hh, line 84
> and line 85 both use the function fuzzyEquals to deal with the limits
> of the dot product calculation. However, the default tolerance for
> fuzzyEquals is 1e-5, which is reasonable when working with float
> numbers to protect against precision errors, but in this case it is
> insufficient as we are trying to work with angles quite close to
> these limits, such as 3.13782 (radians) (PI is 3.141…). The default
> fuzzyEquals tolerance is insufficient as the calculated dot product
> is -0.999993 which causes it to return Pi, the wrong angle in this
> case.
> 
> Since I believe there is enough precision in the member variables of
> Vector3 (they are of type double, no?) to work to a few more
> significant digits (say, setting the tolerance to 1e-8 solves our
> problem and returns the angles we require) is there any particular
> reason that the fuzzyEquals tolerance is left to default at 1e-5? We
> are bringing up the issue to see if this has been considered in the
> construction of the code as we believe this may cause problems with
> other applications of Rivet working with these small angles as well,
> since this “workaround” requires a modification of the Rivet header
> directly. If there is any misunderstanding of the issue of our part,
> please let us know.
> 
> Thank you for your time, and we kindly await for your reply.
> 
> Best Regards,
> 
> Yik Tung Ho 4th Year MSci Physics University College London 
> _______________________________________________ Rivet mailing list 
> Rivet at projects.hepforge.org 
> https://www.hepforge.org/lists/listinfo/rivet
> 


-- 
Dr Andy Buckley, Royal Society University Research Fellow
Particle Physics Expt Group, University of Glasgow / PH Dept, CERN


More information about the Rivet mailing list