
Boost : 
From: Damian Vicino (damian_at_[hidden])
Date: 20200117 00:10:54
That's because pi is not pi but an approximation of it. When you multiply
you amplify the error.
On Thu, Jan 16, 2020, 18:48 anshu khare via Boost <boost_at_[hidden]>
wrote:
> Cos(pi/2) gives an exact zero.
> Cos(3*pi/2) gives a value less than â‚¬.
> But cos(7*pi/2) gives a large negative value which is not less than â‚¬.
>
> Anshu
>
> On Thu, 16 Jan, 2020, 11:29 PM John Maddock via Boost, <
> boost_at_[hidden]> wrote:
>
> >
> > On 16/01/2020 15:08, anshu khare via Boost wrote:
> > > cos(3*pi(cpp_bin_float_50>()/2)) does not give correct value.
> >
> > What do you call "correct"? If you're expecting an exact 0 result, then
> > you're going to be disappointed  likewise with double which also does
> > not yield an exact 0 in your test case (at least on msvc).
> >
> > John.
> >
> > > Only cos(pi(cpp_bin_float_50>()/2)) gives correct value.
> > > All odd multiples of cos(pi/2) do not give correct value.
> > >
> > > The issue with sin() as well.
> > >
> > > Anshu
> > >
> > > _______________________________________________
> > > Unsubscribe & other changes:
> > http://lists.boost.org/mailman/listinfo.cgi/boost
> >
> > _______________________________________________
> > Unsubscribe & other changes:
> > http://lists.boost.org/mailman/listinfo.cgi/boost
> >
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk