Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

toExternalString for nonreal RR objects #3631

Draft
wants to merge 3 commits into
base: development
Choose a base branch
from

Conversation

d-torrance
Copy link
Member

The following behavior of toExternalString isn't quite right:

i1 : x = numeric infinity

o1 = infinity

o1 : RR (of precision 53)

i2 : toExternalString oo

o2 = infinity

i3 : value oo

o3 = infinity

o3 : InfiniteNumber

i4 : x = numeric indeterminate

o4 = NotANumber

o4 : RR (of precision 53)

i5 : toExternalString oo

o5 = NotANumber

i6 : value oo

o6 = NotANumber

o6 : Symbol

Ideally, value @@ toExternalString should act like identity, and in both cases, we're ending up with instances of a completely different class!

To solve this, we:

  • Introduce NotANumber, a new instance of IndeterminateNumber.
  • Introduce the Number_ZZ syntactic sugar for numeric.
  • Modify toExternalString to take advantage of these changes.

So now we have:

i1 : toExternalString numeric infinity

o1 = infinity_53

i2 : value oo

o2 = infinity

o2 : RR (of precision 53)

i3 : toExternalString numeric indeterminate

o3 = NotANumber_53

i4 : value oo

o4 = NotANumber

o4 : RR (of precision 53)

This is a draft for now since there are conflicts with #3630 and I should add tests and docs.

It's another instance of IndeterminateNumber, like indeterminate.  We
update this class so that each instance is a list containing a single
string, which we use for the string methods.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant