Skip to content

Numeric conversion utility functions do not account for floating point errors #18869

@jeremystretch

Description

@jeremystretch

Deployment Type

NetBox Cloud

NetBox Version

v4.2.5

Python Version

3.10

Steps to Reproduce

  1. Attempt to convert feet to meters using the to_meters() utility function:
>>> from utilities.conversion import to_meters
>>> to_meters(30, 'ft')
Decimal('9.144000000000000460964599824')

Expected Behavior

The function should return the clean decimal value 9.144.

Observed Behavior

The returned value includes a floating point error.

The to_grams() utility function is affected as well.

Metadata

Metadata

Assignees

Labels

severity: lowDoes not significantly disrupt application functionality, or a workaround is availablestatus: acceptedThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the application

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions