Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Converting numpy float64 of python float to Decimal is not the same (get rounded in numpy case) #1833

Closed
@seb5g

Description

@seb5g

Environment

  • Pythonnet version: '2.5.1'
  • Python version: 3.8.12
  • Operating System: Win10
  • .NET Runtime: 4.8.4470.0
  • numpy version: 1.21.4

Details

  • Describe what you were trying to get done.

I had to convert floats to Decimal but somehow the current Double I got out of Decimal when looking at it using ToDouble would give me only the round part of the double. I figured that my floats were not native python but numpy float64 . This issue happens only with numpy floats..

importclrfromSystemimportDecimalimportnumpyasnpd=45.5assertd==np.array([d])[0]# should be fineassertDecimal(d)==Decimal(np.array([d])[0])# assertion error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp