Opened 3 years ago

Closed 3 years ago

#21518 closed defect (fixed)

Integer log is puzzled by Python int argument

Reported by: rws Owned by:
Priority: major Milestone: sage-7.4
Component: numerical Keywords:
Cc: Merged in:
Authors: Ralf Stephan Reviewers: Travis Scrimshaw
Report Upstream: N/A Work issues:
Branch: ab830ba (Commits) Commit: ab830ba125650250d003cc52e540993f244d1be2
Dependencies: #21517 Stopgaps:

Description

sage: ZZ(8).log(int(2))
log(8)/log(2)

Change History (12)

comment:1 Changed 3 years ago by rws

  • Branch set to u/rws/integer_log_is_puzzled_by_python_int_argument

comment:2 Changed 3 years ago by rws

  • Authors set to Ralf Stephan
  • Commit set to 3ce2cd2f4569ab9f19cb26fe1d1b1304044ae3f0
  • Dependencies set to #21517
  • Status changed from new to needs_review

New commits:

de1acfa21517: handle ZZ.log(1/n)
3ce2cd221518: accept Python ints as log base to ZZ.log

comment:3 Changed 3 years ago by tscrim

Why not if type(m) == int:? Or perhaps, a more robust if m in ZZ: (or try: m = Integer(m))?

comment:4 Changed 3 years ago by tscrim

  • Reviewers set to Travis Scrimshaw

comment:5 Changed 3 years ago by git

  • Commit changed from 3ce2cd2f4569ab9f19cb26fe1d1b1304044ae3f0 to 79a5a4a3a653880fac7a437c6cbd9e11c8930bb0

Branch pushed to git repo; I updated commit sha1. New commits:

79a5a4a21518: improve code

comment:6 Changed 3 years ago by git

  • Commit changed from 79a5a4a3a653880fac7a437c6cbd9e11c8930bb0 to 33a0de346639a01269259433e34033950122bb47

Branch pushed to git repo; I updated commit sha1. New commits:

4aba8a921517: avoid duplicate computations
33a0de3Merge branch 'u/rws/log_of_integer_to_base_1_n_can_have_exact_numeric_results' of trac.sagemath.org:sage into t/21518/integer_log_is_puzzled_by_python_int_argument

comment:7 Changed 3 years ago by tscrim

Why is the if m is None: case in the try block? Could we just test that first?

comment:8 Changed 3 years ago by git

  • Commit changed from 33a0de346639a01269259433e34033950122bb47 to 6e250f0c48f717763c358708c8154eb2770176a9

Branch pushed to git repo; I updated commit sha1. New commits:

6e250f021518: reorder some lines

comment:9 Changed 3 years ago by tscrim

One last thing, the if m in None: block is 1 over indented. Once you make this change, you can set a positive review on my behalf.

comment:10 Changed 3 years ago by git

  • Commit changed from 6e250f0c48f717763c358708c8154eb2770176a9 to ab830ba125650250d003cc52e540993f244d1be2

Branch pushed to git repo; I updated commit sha1. New commits:

ab830ba21518: cosmetics

comment:11 Changed 3 years ago by rws

  • Status changed from needs_review to positive_review

Thanks for the review.

comment:12 Changed 3 years ago by vbraun

  • Branch changed from u/rws/integer_log_is_puzzled_by_python_int_argument to ab830ba125650250d003cc52e540993f244d1be2
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.