Closed
Description
Environment
- Pythonnet version: 3.0.0rc4
- Python version: 3.10.5
- Operating System: Windows 10 20H2
- .NET Runtime: 6.0.6
Details
-
Describe what you were trying to get done.
I'm sorry it's me again with some weird low-level issue. I use a DLL where a function returns a
System.Single
. Its return value is0.01
. Before pythonnet version 3.0 this got converted to a Pythonfloat
also of value0.01
. With Pythonnet 3.0 I get a Pythonfloat
0.009999999776482582
instead. I can reproduce this issue by creatingSystem.Single
objects. -
What commands did you run to trigger this issue? If you can provide a
Minimal, Complete, and Verifiable example
this will help us understand the issue.import clr import System # Parse a string to avoid conversion from Python float to dotnet print(System.Single.Parse('1e-2')) # Create a pure dotnet object without conversion back to Python (I think .ToString() gets called here?) print(System.Single(0.01)) # Create a pure dotnet object without conversion back to Python and convert back to Python print(System.Single(0.01).MemberwiseClone())
0.009999999776482582 0.01 0.009999999776482582
With pythonnet 2.5.2 this will return
0.01 0.01 0.01
Metadata
Metadata
Assignees
Labels
No labels