Re: [sage-devel] issue with cos(pi/2) and sin(pi)

2018-08-15 Thread David Coudert
> Le 14 août 2018 à 20:37, TB a écrit : > > Because float(pi/2) is not exactly pi/2: > > sage: n(pi/2 - float(pi/2), 53) > 0.000 > sage: n(pi/2 - float(pi/2), 54) # also for perc > 54 of course > 1.11022302462516e-16 and what’s the advantage of numerical_approx(v, digits=10) over

Re: [sage-devel] issue with cos(pi/2) and sin(pi)

2018-08-14 Thread TB
Because float(pi/2) is not exactly pi/2: sage: n(pi/2 - float(pi/2), 53) 0.000 sage: n(pi/2 - float(pi/2), 54) # also for perc > 54 of course 1.11022302462516e-16 This does mean that: sage: float(cos(pi/2)) 0.0 sage: float(sin(pi)) 0.0 Regards, TB On 14/08/18 21:02,

[sage-devel] issue with cos(pi/2) and sin(pi)

2018-08-14 Thread David . Coudert
I looking for a smart way to fix the following issue that we have when plotting graphs (see #22050 and #24512 for instance): cos(pi/2) is not 0 and sin(pi) is not 0 ! sage: G = Graph(4) sage: _circle_embedding(G, G.vertices()) sage: G._pos {0: (1.0, 0.0), 1: (6.123233995736766e-17, 1.0), #