Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

Commit

Permalink
Fix: Paramters: Constant eq float error
Browse files Browse the repository at this point in the history
  • Loading branch information
iopapamanoglou committed Sep 2, 2024
1 parent c517f46 commit b44a196
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/faebryk/library/Constant.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

from typing import Self, SupportsAbs

import numpy as np

from faebryk.core.parameter import Parameter, _resolved
from faebryk.libs.units import Quantity

Expand Down Expand Up @@ -32,6 +34,11 @@ def __eq__(self, other) -> bool:
if not isinstance(other, Constant):
return False

try:
return np.allclose(self.value, other.value)
except (TypeError, np.exceptions.DTypePromotionError):
...

return self.value == other.value

def __hash__(self) -> int:
Expand Down

0 comments on commit b44a196

Please sign in to comment.