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

Error Evaluating float(x) ** float(y) #50438

Closed
Zero mannequin opened this issue Jun 3, 2009 · 3 comments
Closed

Error Evaluating float(x) ** float(y) #50438

Zero mannequin opened this issue Jun 3, 2009 · 3 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error

Comments

@Zero
Copy link
Mannequin

Zero mannequin commented Jun 3, 2009

BPO 6188
Nosy @mdickinson

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2009-06-03.13:30:48.136>
created_at = <Date 2009-06-03.13:20:01.192>
labels = ['interpreter-core', 'type-bug', 'invalid']
title = 'Error Evaluating float(x) ** float(y)'
updated_at = <Date 2019-10-31.14:23:36.847>
user = 'https://bugs.python.org/Zero'

bugs.python.org fields:

activity = <Date 2019-10-31.14:23:36.847>
actor = 'Zero'
assignee = 'none'
closed = True
closed_date = <Date 2009-06-03.13:30:48.136>
closer = 'mark.dickinson'
components = ['Interpreter Core']
creation = <Date 2009-06-03.13:20:01.192>
creator = 'Zero'
dependencies = []
files = []
hgrepos = []
issue_num = 6188
keywords = []
message_count = 3.0
messages = ['88808', '88809', '88811']
nosy_count = 2.0
nosy_names = ['exarkun', 'mark.dickinson']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = None
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue6188'
versions = ['Python 3.0']

@Zero
Copy link
Mannequin Author

Zero mannequin commented Jun 3, 2009

This is what I get while the interactive interpreter (IDLE 3.0.1) on the
platform
Python 3.0.1 (r301:69561, Feb 13 2009, 20:04:18) [MSC v.1500 32 bit
(Intel)] on win32

>>> a = -6.276479035564047
>>> b = -5.7974497499584849
>>> a ** b != -6.276479035564047 ** -5.7974497499584849
True
>>> 

Something is wrong. The float values are the same but not evaluated as
being equal.
After writing an automated testing program, these sample numbers were
generated
and found to create erroneous symptoms in the system being
automatically tested.

@Zero Zero mannequin added interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error labels Jun 3, 2009
@exarkun
Copy link
Mannequin

exarkun mannequin commented Jun 3, 2009

Have you checked to see what the result of a ** b is?

@mdickinson
Copy link
Member

This is not a bug: Python's operator precedence rules mean that the
expression

-6.276479035564047 ** -5.7974497499584849

is treated as:

-(6.276479035564047 ** -5.7974497499584849).

>>> a = -6.276479035564047
>>> b = -5.7974497499584849
>>> a ** b != -6.276479035564047 ** -5.7974497499584849
True
>>> a ** b == (-6.276479035564047) ** -5.7974497499584849
True

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant