Skip to content

Commit

Permalink
Add implementation error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
kg583 committed Nov 15, 2024
1 parent 353d059 commit 002e8ee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tivars/types/complex.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ class TIComplexRadical(ComplexEntry, register=True):

@Loader[complex, float, int]
def load_complex(self, comp: complex):
return NotImplemented
raise NotImplementedError("cannot determine exact representation from decimal approximation")


class TIComplexPi(TIComplex, register=True):
Expand All @@ -425,7 +425,7 @@ class TIComplexPi(TIComplex, register=True):

@Loader[complex, float, int]
def load_complex(self, comp: complex):
return NotImplemented
raise NotImplementedError("decimal loading is ambiguous for pi types")


class TIComplexPiFraction(TIComplexPi, TIComplexFraction, register=True):
Expand Down
4 changes: 2 additions & 2 deletions tivars/types/real.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ def sign(self) -> int:

@Loader[Decimal]
def load_decimal(self, decimal: Decimal):
raise NotImplementedError
raise NotImplementedError("cannot determine exact representation from decimal approximation")

def decimal(self) -> Decimal:
return (self.left_scalar * (-1 if self.sign_type % 2 else 1) * Decimal(self.left_radicand).sqrt() +
Expand Down Expand Up @@ -601,7 +601,7 @@ class TIRealPi(TIReal, register=True):

@Loader[Decimal]
def load_decimal(self, decimal: Decimal):
raise NotImplementedError
raise NotImplementedError("decimal loading is ambiguous for pi types")

def decimal(self) -> Decimal:
with localcontext() as ctx:
Expand Down

0 comments on commit 002e8ee

Please sign in to comment.