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

Float Multiplication #39359

Closed
vktor mannequin opened this issue Oct 3, 2003 · 5 comments
Closed

Float Multiplication #39359

vktor mannequin opened this issue Oct 3, 2003 · 5 comments
Assignees
Labels
docs Documentation in the Doc dir

Comments

@vktor
Copy link
Mannequin

vktor mannequin commented Oct 3, 2003

BPO 816946
Nosy @mwhudson, @freddrake

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 = 'https://github.com/freddrake'
closed_at = <Date 2003-10-06.10:07:42.000>
created_at = <Date 2003-10-03.04:09:06.000>
labels = ['invalid', 'docs']
title = 'Float Multiplication'
updated_at = <Date 2003-10-06.10:07:42.000>
user = 'https://bugs.python.org/vktor'

bugs.python.org fields:

activity = <Date 2003-10-06.10:07:42.000>
actor = 'mwh'
assignee = 'fdrake'
closed = True
closed_date = None
closer = None
components = ['Documentation']
creation = <Date 2003-10-03.04:09:06.000>
creator = 'vktor'
dependencies = []
files = []
hgrepos = []
issue_num = 816946
keywords = []
message_count = 5.0
messages = ['18523', '18524', '18525', '18526', '18527']
nosy_count = 4.0
nosy_names = ['mwh', 'fdrake', 'effbot', 'vktor']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue816946'
versions = ['Python 2.3']

@vktor
Copy link
Mannequin Author

vktor mannequin commented Oct 3, 2003

Why (1.16 * 100) is not the same than (1.16 * 10 * 10)?

I tried 1.16*100. also and it is = 115.99999999; but if I
do 1.16*10*10 I get 116.

Thanks....

@vktor vktor mannequin closed this as completed Oct 3, 2003
@vktor vktor mannequin added the invalid label Oct 3, 2003
@vktor vktor mannequin assigned freddrake Oct 3, 2003
@vktor vktor mannequin added the docs Documentation in the Doc dir label Oct 3, 2003
@vktor vktor mannequin closed this as completed Oct 3, 2003
@vktor vktor mannequin added the invalid label Oct 3, 2003
@vktor vktor mannequin assigned freddrake Oct 3, 2003
@vktor vktor mannequin added the docs Documentation in the Doc dir label Oct 3, 2003
@effbot
Copy link
Mannequin

effbot mannequin commented Oct 3, 2003

Logged In: YES
user_id=38376

The answer to your question can be found in the Python
tutorial, and has nothing to do with regular expressions:

http://www.python.org/doc/tut/node14.html

Please don't use the bug tracker to ask for help in the
future; I suggest asking on comp.lang.python (for other
help forums, see www.python.org).

@vktor
Copy link
Mannequin Author

vktor mannequin commented Oct 4, 2003

Logged In: YES
user_id=879316

I'sorry, but I don't agree...
Even 3.13 (3.1299999999999999) * 100 is 313 = like
3.13*10*10 (3.13*100=3.13*10*10)
In this case 1.16*100 <> 1.16*10*10
Sorry again, but it is a huge difference when you do int
(1.16*100)=115 or you do int(1.16*10*10)=116
Thanks...

@vktor
Copy link
Mannequin Author

vktor mannequin commented Oct 4, 2003

Logged In: YES
user_id=879316

This is not a bug.

Binary floating point cannot represent decimal fractions exactly,
so some rounding always occurs (even in Python 1.5.2).

What changed is that Python 2.0 shows more precision than before
in certain circumstances (repr() and the interactive prompt).

You can use str() or print to get the old, rounded output:

>>> print 0.1+0.1
0.2
>>>

Follow the link for more information:

http://www.python.org/doc/2.2.1/tut/node14.html

@mwhudson
Copy link

mwhudson commented Oct 6, 2003

Logged In: YES
user_id=6656

Close again.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir
Projects
None yet
Development

No branches or pull requests

2 participants