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
Environment
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 Pythonfloatalso of value0.01. With Pythonnet 3.0 I get a Pythonfloat0.009999999776482582instead. I can reproduce this issue by creatingSystem.Singleobjects.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.
With pythonnet 2.5.2 this will return