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

conversion error #5400

Closed
jasongrout opened this issue Feb 28, 2009 · 17 comments
Closed

conversion error #5400

jasongrout opened this issue Feb 28, 2009 · 17 comments
Assignees
Milestone

Comments

@jasongrout
Copy link
Member

Using Sage 3.4.alpha0:

{{{sage: RDF(e^(1j))
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (1419, 0))

ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (1535, 0))

ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (1419, 0))

ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (1419, 0))

(then a TypeError is thrown since I don't have an RDF value)

}}}

Now, of course, the above gives a TypeError, but there still shouldn't be the scary preparser error.

CC: @sagetrac-mvngu

Component: misc

Issue created by migration from https://trac.sagemath.org/ticket/5400

@jasongrout
Copy link
Member Author

comment:1

Trying this again:

sage: RDF(e^(1j))
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (1419, 0))

ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (1535, 0))

ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (1419, 0))

ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (1419, 0))

@jasongrout
Copy link
Member Author

comment:3

Robert, I "assigned" you the bug because I don't know an easy way to CC you on the bug report, since you are likely the best person to look at this currently.

@sagetrac-mabshoff
Copy link
Mannequin

sagetrac-mabshoff mannequin commented Feb 28, 2009

comment:4

Replying to @jasongrout:

Robert, I "assigned" you the bug because I don't know an easy way to CC you on the bug report, since you are likely the best person to look at this currently.

I assume you know about the CC field, so what is the problem?

Many account holders in trac are listed at http://trac.sagemath.org/sage_trac/wiki

Cheers,

Michael

@jasongrout
Copy link
Member Author

comment:5

The only CC option I have now with the new trac is to add myself. It's not a text box anymore.

@sagetrac-mabshoff
Copy link
Mannequin

sagetrac-mabshoff mannequin commented Feb 28, 2009

comment:6

Replying to @jasongrout:

The only CC option I have now with the new trac is to add myself. It's not a text box anymore.

Ok, this is a permission issue with the new trac since I can CC anybody :)

This is now #5401.

Cheers,

Michael

@robertwb
Copy link
Contributor

comment:7

Hmm... this doesn't happen in 3.3.

What does sage: preparse('RDF(e^(1j))') give you?

@robertwb
Copy link
Contributor

comment:8

This is not a preparsing bug.

sage: a = sage: a = e^1j; a
 e^(1.0*I)
sage: RDF(a)
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (1088, 0))
...

@robertwb robertwb changed the title parser error converersoin error Feb 28, 2009
@jasongrout
Copy link
Member Author

comment:9

Good point with your test. The tokenizing statement made me think it was the preparser.

@jasongrout jasongrout changed the title converersoin error conversion error Mar 1, 2009
@robertwb
Copy link
Contributor

comment:10

This gives the correct error now.

sage: RDF(e^(1j))
------------------------------------------------------------
Traceback (most recent call last):
  File "<ipython console>", line 1, in <module>
  File "parent.pyx", line 288, in sage.structure.parent.Parent.__call__ (sage/structure/parent.c:4320)
  File "coerce_maps.pyx", line 155, in sage.structure.coerce_maps.NamedConvertMap._call_ (sage/structure/coerce_maps.c:4225)
  File "/usr/local/sage/local/lib/python2.5/site-packages/sage/calculus/calculus.py", line 5834, in _real_double_
    return self._convert(field)
  File "/usr/local/sage/local/lib/python2.5/site-packages/sage/calculus/calculus.py", line 5718, in _convert
    return typ(g)
  File "parent.pyx", line 288, in sage.structure.parent.Parent.__call__ (sage/structure/parent.c:4320)
  File "coerce_maps.pyx", line 155, in sage.structure.coerce_maps.NamedConvertMap._call_ (sage/structure/coerce_maps.c:4225)
  File "/usr/local/sage/local/lib/python2.5/site-packages/sage/calculus/calculus.py", line 5834, in _real_double_
    return self._convert(field)
  File "/usr/local/sage/local/lib/python2.5/site-packages/sage/calculus/calculus.py", line 5712, in _convert
    fops = [typ(op) for op in self._operands]
  File "parent.pyx", line 288, in sage.structure.parent.Parent.__call__ (sage/structure/parent.c:4320)
  File "coerce_maps.pyx", line 155, in sage.structure.coerce_maps.NamedConvertMap._call_ (sage/structure/coerce_maps.c:4225)
  File "/usr/local/sage/local/lib/python2.5/site-packages/sage/calculus/calculus.py", line 5834, in _real_double_
    return self._convert(field)
  File "/usr/local/sage/local/lib/python2.5/site-packages/sage/calculus/calculus.py", line 5712, in _convert
    fops = [typ(op) for op in self._operands]
  File "parent.pyx", line 288, in sage.structure.parent.Parent.__call__ (sage/structure/parent.c:4320)
  File "coerce_maps.pyx", line 155, in sage.structure.coerce_maps.NamedConvertMap._call_ (sage/structure/coerce_maps.c:4225)
  File "/usr/local/sage/local/lib/python2.5/site-packages/sage/calculus/calculus.py", line 4839, in _real_double_
    return R(self._obj)
  File "parent.pyx", line 288, in sage.structure.parent.Parent.__call__ (sage/structure/parent.c:4320)
  File "coerce_maps.pyx", line 155, in sage.structure.coerce_maps.NamedConvertMap._call_ (sage/structure/coerce_maps.c:4225)
  File "/usr/local/sage/local/lib/python2.5/site-packages/sage/functions/constants.py", line 973, in _real_double_
    raise TypeError
TypeError

@TimDumol
Copy link
Mannequin

TimDumol mannequin commented Jan 18, 2010

Work Issues: Close/mark as fixed?

@TimDumol
Copy link
Mannequin

TimDumol mannequin commented Jan 18, 2010

comment:11

Right now it gives?:

sage: RDF(e^(1j))
[...]
/home/timdumol/sage-4.3.1.alpha0/local/lib/python2.6/site-packages/sage/rings/complex_number.so in sage.rings.complex_number.ComplexNumber.__float__ (sage/rings/complex_number.c:7209)()

TypeError: can't convert complex to float; use abs(z)

This seems to be the right error. Should this be closed?

@robertwb
Copy link
Contributor

comment:12

I hate the fact that

sage: RR(CC(-1))
-1.00000000000000

but

sage: RDF(CDF(-1))
------------------------------------------------------------
Traceback (most recent call last):
  File "<ipython console>", line 1, in <module>
  File "parent.pyx", line 538, in sage.structure.parent.Parent.__call__ (sage/structure/parent.c:5007)
  File "coerce_maps.pyx", line 82, in sage.structure.coerce_maps.DefaultConvertMap_unique._call_ (sage/structure/coerce_maps.c:3109)
  File "coerce_maps.pyx", line 77, in sage.structure.coerce_maps._call_ (sage/structure/coerce_maps.c:3000)
  File "real_double.pyx", line 540, in sage.rings.real_double.RealDoubleElement.__init__ (sage/rings/real_double.c:5553)
  File "complex_double.pyx", line 808, in sage.rings.complex_double.ComplexDoubleElement.__float__ (sage/rings/complex_double.c:6628)
TypeError: can't convert complex to float; use abs(z)

@jasongrout
Copy link
Member Author

comment:13

Replying to @robertwb:

I hate the fact that

sage: RR(CC(-1))
-1.00000000000000

but

sage: RDF(CDF(-1))
------------------------------------------------------------
Traceback (most recent call last):
  File "<ipython console>", line 1, in <module>
  File "parent.pyx", line 538, in sage.structure.parent.Parent.__call__ (sage/structure/parent.c:5007)
  File "coerce_maps.pyx", line 82, in sage.structure.coerce_maps.DefaultConvertMap_unique._call_ (sage/structure/coerce_maps.c:3109)
  File "coerce_maps.pyx", line 77, in sage.structure.coerce_maps._call_ (sage/structure/coerce_maps.c:3000)
  File "real_double.pyx", line 540, in sage.rings.real_double.RealDoubleElement.__init__ (sage/rings/real_double.c:5553)
  File "complex_double.pyx", line 808, in sage.rings.complex_double.ComplexDoubleElement.__float__ (sage/rings/complex_double.c:6628)
TypeError: can't convert complex to float; use abs(z)

That problem should be a different ticket.

This ticket should be closed.

@jasongrout
Copy link
Member Author

comment:14

The CDF float conversion problem is now #8869

@jasongrout
Copy link
Member Author

comment:15

The issue for this ticket is fixed. This ticket should be closed.

@sagetrac-mvngu
Copy link
Mannequin

sagetrac-mvngu mannequin commented May 11, 2010

comment:16

Close as fixed:

[mvngu@sage ~]$ sage
----------------------------------------------------------------------
| Sage Version 4.4.1, Release Date: 2010-05-02                       |
| Type notebook() for the GUI, and license() for information.        |
----------------------------------------------------------------------
sage: RR(CC(-1))
-1.00000000000000
sage: RDF(CDF(-1))
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)

/home/mvngu/<ipython console> in <module>()

/usr/local/sage/local/lib/python2.6/site-packages/sage/structure/parent.so in sage.structure.parent.Parent.__call__ (sage/structure/parent.c:6332)()

/usr/local/sage/local/lib/python2.6/site-packages/sage/structure/coerce_maps.so in sage.structure.coerce_maps.DefaultConvertMap_unique._call_ (sage/structure/coerce_maps.c:3108)()

/usr/local/sage/local/lib/python2.6/site-packages/sage/structure/coerce_maps.so in sage.structure.coerce_maps.DefaultConvertMap_unique._call_ (sage/structure/coerce_maps.c:3010)()

/usr/local/sage/local/lib/python2.6/site-packages/sage/rings/real_double.so in sage.rings.real_double.RealDoubleElement.__init__ (sage/rings/real_double.c:5541)()

/usr/local/sage/local/lib/python2.6/site-packages/sage/rings/complex_double.so in sage.rings.complex_double.ComplexDoubleElement.__float__ (sage/rings/complex_double.c:6510)()

TypeError: can't convert complex to float; use abs(z)

@sagetrac-mvngu
Copy link
Mannequin

sagetrac-mvngu mannequin commented May 11, 2010

Changed work issues from Close/mark as fixed? to none

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants