Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit 4f7b161

Browse files
committed
9424: make ceil/floor accept kwds; fix doctests
1 parent 985fdb4 commit 4f7b161

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/sage/functions/other.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ def _print_latex_(self, x):
386386
return r"\left \lceil %s \right \rceil"%latex(x)
387387

388388
#FIXME: this should be moved to _eval_
389-
def __call__(self, x, maximum_bits=20000):
389+
def __call__(self, x, **kwds):
390390
"""
391391
Allows an object of this class to behave like a function. If
392392
``ceil`` is an instance of this class, we can do ``ceil(n)`` to get
@@ -401,6 +401,7 @@ def __call__(self, x, maximum_bits=20000):
401401
sage: ceil(int(10^50))
402402
100000000000000000000000000000000000000000000000000
403403
"""
404+
maximum_bits = kwds.get('maximum_bits', 20000)
404405
try:
405406
return x.ceil()
406407
except AttributeError:
@@ -470,7 +471,7 @@ def _evalf_(self, x, **kwds):
470471
471472
sage: h(x) = ceil(x)
472473
sage: h(pi)._numerical_approx()
473-
4
474+
4.00000000000000
474475
"""
475476
return self._eval_(x)
476477

@@ -557,7 +558,7 @@ def _print_latex_(self, x):
557558
return r"\left \lfloor %s \right \rfloor"%latex(x)
558559

559560
#FIXME: this should be moved to _eval_
560-
def __call__(self, x, maximum_bits=20000):
561+
def __call__(self, x, **kwds):
561562
"""
562563
Allows an object of this class to behave like a function. If
563564
``floor`` is an instance of this class, we can do ``floor(n)`` to
@@ -572,6 +573,7 @@ def __call__(self, x, maximum_bits=20000):
572573
sage: floor(int(10^50))
573574
100000000000000000000000000000000000000000000000000
574575
"""
576+
maximum_bits = kwds.get('maximum_bits',20000)
575577
try:
576578
return x.floor()
577579
except AttributeError:
@@ -642,7 +644,7 @@ def _evalf_(self, x, **kwds):
642644
643645
sage: h(x) = floor(x)
644646
sage: h(pi)._numerical_approx()
645-
3
647+
3.00000000000000
646648
"""
647649
return self._eval_(x)
648650

0 commit comments

Comments
 (0)