🌐 AI搜索 & 代理 主页
Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
1990 Fixed bug related to converting number to a string
There was an issue with values between 128 and 256, possibly because of some bug inside BigInteger, which I did not fully understand.

Anyway, it seems that a simpler solution is to just use LongInteger when possible.
  • Loading branch information
rmadsen-ks committed Oct 28, 2022
commit 21e2f88f58663f0348d9c6ce2d1d629a4ac787a4
1 change: 1 addition & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,4 @@
- ([@alxnull](https://github.com/alxnull))
- ([@gpetrou](https://github.com/gpetrou))
- Ehsan Iran-Nejad ([@eirannejad](https://github.com/eirannejad))
- Rolf Madsen ([@rmadsen-ks](https://github.com/rmadsen-ks))
3 changes: 2 additions & 1 deletion src/runtime/PythonTypes/PyInt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@ public BigInteger ToBigInteger()
public string ToString(string format, IFormatProvider formatProvider)
{
using var _ = Py.GIL();
return ToBigInteger().ToString(format, formatProvider);
object val = Runtime.PyLong_AsLongLong(obj);
return val?.ToString() ?? ToBigInteger().ToString(format, formatProvider);
}

public override TypeCode GetTypeCode() => TypeCode.Int64;
Expand Down