Opened 4 years ago

Closed 4 years ago

#26757 closed enhancement (fixed)

py3: fixing round in graph_latex.py

Reported by: David Coudert Owned by:
Priority: major Milestone: sage-8.5
Component: python3 Keywords: py3, graph
Cc: Travis Scrimshaw, Frédéric Chapoton Merged in:
Authors: David Coudert Reviewers: Travis Scrimshaw
Report Upstream: N/A Work issues:
Branch: d1888e4 (Commits, GitHub, GitLab) Commit: d1888e4f90adfdda9194193d2539988cbc6051c2
Dependencies: Stopgaps:

Status badges

Description (last modified by David Coudert)

Several round are failing in graph_latex.py as RealNumber does not define round.

TypeError: type sage.rings.real_mpfr.RealNumber doesn't define __round__ method

We fix that using round(float(...)).

Change History (5)

comment:1 Changed 4 years ago by David Coudert

Branch: public/26757_round_in_graph_latex
Cc: Travis Scrimshaw Frédéric Chapoton added
Commit: d1888e4f90adfdda9194193d2539988cbc6051c2
Description: modified (diff)
Status: newneeds_review

New commits:

d1888e4trac #26757: fixing round in graph_latex.py

comment:2 Changed 4 years ago by Travis Scrimshaw

I wonder if this is the correct fix. We might loose precision, and it seems natural that RealNumber would define a __round__ (or round). Thoughts?

comment:3 Changed 4 years ago by David Coudert

I followed what has been done in #26684. Of course, it would be better to get a __round__ method for RealNumber.

comment:4 Changed 4 years ago by Travis Scrimshaw

Reviewers: Travis Scrimshaw
Status: needs_reviewpositive_review

Okay, fair enough. LGTM.

comment:5 Changed 4 years ago by Volker Braun

Branch: public/26757_round_in_graph_latexd1888e4f90adfdda9194193d2539988cbc6051c2
Resolution: fixed
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.