[issue41071] from an int to a float , why

2020-06-22 Thread mike stern


mike stern  added the comment:

i am calm

but sometimes I am wondering if the philosophy behind python is really like 
they claimed to make it very simple. Well I see a lot of confusions sometimes , 
and this is one


From: report=bugs.python@roundup.psfhosted.org 
 on behalf of Tim Peters 

Sent: Monday, June 22, 2020 5:59 PM
To: rskir...@hotmail.com 
Subject: [issue41071] from an int to a float , why

Tim Peters  added the comment:

Mike, read that exchange again. You originally wrote

"print(2 / 2) gives 2.0 instead of 2"

but you didn't _mean_ that. You meant to say it "gives 1.0 instead of 1", or 
you meant something other than "2 / 2").  In Python 3,

>>> print(2 / 2)
1.0

Which is what Serhiy said it does.

For the rest, read the PEP again after you calm down. In particular,

"Classic division will remain the default in the Python 2.x series; true 
division will be standard in Python 3.0."

Also all true.

--

___
Python tracker 
<https://bugs.python.org/issue41071>
___

--

___
Python tracker 
<https://bugs.python.org/issue41071>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41071] from an int to a float , why

2020-06-22 Thread mike stern


mike stern  added the comment:

sorry but that article was about version 2.2 in 2000

Created:11-Mar-2001
Python-Version: 2.2

where is the one for 3.7


From: report=bugs.python@roundup.psfhosted.org 
 on behalf of Tim Peters 

Sent: Monday, June 22, 2020 5:20 PM
To: rskir...@hotmail.com 
Subject: [issue41071] from an int to a float , why

Tim Peters  added the comment:

Read the PEP Serhiy already linked to:

https://www.python.org/dev/peps/pep-0238/

This was a deliberate change to how "integer / integer" works, introduced with 
Python 3.

--
nosy: +tim.peters
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue41071>
___

--

___
Python tracker 
<https://bugs.python.org/issue41071>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41071] from an int to a float , why

2020-06-22 Thread mike stern


mike stern  added the comment:

I appreciate your answer
I just didn't like how she answered earlier saying

I cannot reproduce. 2 / 2 gives 1.0 to me.

which is not true

thanks anyway, now i am gonna have to do some reading


From: report=bugs.python@roundup.psfhosted.org 
 on behalf of Tim Peters 

Sent: Monday, June 22, 2020 5:20 PM
To: rskir...@hotmail.com 
Subject: [issue41071] from an int to a float , why

Tim Peters  added the comment:

Read the PEP Serhiy already linked to:

https://www.python.org/dev/peps/pep-0238/

This was a deliberate change to how "integer / integer" works, introduced with 
Python 3.

--
nosy: +tim.peters
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue41071>
___

--

___
Python tracker 
<https://bugs.python.org/issue41071>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41071] from an int to a float , why

2020-06-22 Thread mike stern


mike stern  added the comment:

Not satisfied with that reply

you can't just decide to close the ticket without even giving a reasonable 
answer, or even try that on 2.7 or 3.7 to see if it is true what I said.
Besides, that is not a convincing answer, that is actually no answer at all!!!

I made my research and this is what is it 
https://stackoverflow.com/questions/183853/what-is-the-difference-between-and-when-used-for-division

in python 2.7 
print((20 / 3)) > 6
but
print((20.0 / 3)) or print((20 / 3.0)) or print((20.0 / 3.0)) > 
6.667
however 
print((20 / 2)) > 10 # integer number


in python 3.7
print((20 / 3)) > 6.667
not only that but even
print((20 / 2)) > 10.0  # float number
unless you use //
print((20 // 2)) > 10

can someone really explain this ?

--
status: closed -> open

___
Python tracker 
<https://bugs.python.org/issue41071>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41071] from an int to a float , why

2020-06-22 Thread mike stern


New submission from mike stern :

please I would like to know why python changes an integer result in a division 
to a float even in the result is even

like print(2 / 2) gives 2.0 instead of 2

or 

a = 2 / 2
print(a)

--
components: Interpreter Core
messages: 372033
nosy: rskir...@hotmail.com
priority: normal
severity: normal
status: open
title: from an int to a float , why
type: behavior
versions: Python 3.7

___
Python tracker 
<https://bugs.python.org/issue41071>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40981] increment is wrong in 3.7 but not in 2.7

2020-06-15 Thread mike stern


mike stern  added the comment:

sorry but I don't see the option to delete


From: report=bugs.python@roundup.psfhosted.org 
 on behalf of Terry J. Reedy 

Sent: Monday, June 15, 2020 11:46 AM
To: rskir...@hotmail.com 
Subject: [issue40981] increment is wrong in 3.7 but not in 2.7

Terry J. Reedy  added the comment:

Mike, when you respond by email, delete the text you are responding to.  Your 
email is posted below the already posted text and the quote is useless noise 
that makes it harder to see what you wrote.

Newcomers to Python who think they have seen a bug should best post to 
python-list or similar forums asking "Is this a bug?  If not, please explain.".

--
nosy: +terry.reedy

___
Python tracker 
<https://bugs.python.org/issue40981>
___

--

___
Python tracker 
<https://bugs.python.org/issue40981>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40981] increment is wrong in 3.7 but not in 2.7

2020-06-15 Thread mike stern


mike stern  added the comment:

I appreciate taking the time to explain , I just wished the other guys did that 
instead of just closing the ticket on my face.
I wished at least they suggested me to use round() without any aggravations

but thanks anyway


From: report=bugs.python@roundup.psfhosted.org 
 on behalf of Steven D'Aprano 

Sent: Monday, June 15, 2020 2:51 AM
To: rskir...@hotmail.com 
Subject: [issue40981] increment is wrong in 3.7 but not in 2.7

Steven D'Aprano  added the comment:

> I wouldn't trust a language behaving crazy like this

I guess then you won't trust C, Java, C++, Swift, Javascript, Ruby, Cobol, 
Fortran, and pretty much every programming language in existence. The only ones 
that escape this are ones that don't have floating point numbers at all.

> you haven't tried it on 2.7 did you ?

We know how Python 2.7 works. Some of us have been using Python for 25 years, 
since version 1.5 or older. Do you think you are the first person to have 
noticed this? There are hundreds of thousands of Python programmers, believe me 
you're not the first, or even the ten-thousandth person to have noticed.

Python 2.7 rounds off the default display of floats to make them look "pretty" 
instead of displaying their actual value. Try this in 2.7 and see what happens:

i=0
while i < 1.2:
i += 0.1
print "default:", i, "actual: %.24f" % i

The calculations are *precisely* the same, only the display is different.

Honestly Mike, this is not a Python issue, it is universal to all languages 
with fixed-size floating point numbers. This is not a bug, it is how numeric 
computing works *everywhere*. People write peer reviewed scientific papers 
about this:

http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.22.6768

https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html

If you want to educate yourself on the issue, rather than just rant about not 
trusting the language and abuse people who have been using the language for 
decades, you could do a lot worse than to start here:

https://randomascii.wordpress.com/2012/05/20/thats-not-normalthe-performance-of-odd-floats/

https://randomascii.wordpress.com/2012/04/05/floating-point-complexities/

and take careful note that the author talks about C, probably the most common, 
fundamental and trusted programming language in the world. (Also remember that 
when Bruce Dawson talks about floats in C, they are half the precision of 
Python floats, which are C doubles.)

The bottom line is that floats are not the infinitely precise exact 
mathematical numbers we learn about in school, they are more like the numbers 
you get on a calculator.

--
nosy: +steven.daprano

___
Python tracker 
<https://bugs.python.org/issue40981>
___

--

___
Python tracker 
<https://bugs.python.org/issue40981>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40981] increment is wrong in 3.7 but not in 2.7

2020-06-14 Thread mike stern


mike stern  added the comment:

you can at least try it and see for yourself that what I am saying is actually 
true

but never mind I will keep on opening tickets until someone tries it on 2.7 and 
see what I am talking about


From: Redwane Freedom Is-to-Be-With-God 
Sent: Monday, June 15, 2020 2:45 AM
To: Python tracker 
Subject: Re: [issue40981] increment is wrong in 3.7 but not in 2.7

what is rude is to talk to me in an autoritative way like you do
you haven't even checked what I said , I said it working in Python 2.7 and it 
is not in 3.7
and you want to just read me an article.


From: report=bugs.python@roundup.psfhosted.org 
 on behalf of Christian Heimes 

Sent: Monday, June 15, 2020 2:40 AM
To: rskir...@hotmail.com 
Subject: [issue40981] increment is wrong in 3.7 but not in 2.7

Christian Heimes  added the comment:

Python's float are IEE 754 floats for over 25 years and since Python 1.x, maybe 
earlier. IIRC standard is from 1985. It's how CPUs have dealt with floats for 
over 35 years.

By the way it's is incredible rude to keep re-opening a bug and responding on a 
closed bug. Do not reopen the bug again.

--
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue40981>
___

--

___
Python tracker 
<https://bugs.python.org/issue40981>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40981] increment is wrong in 3.7 but not in 2.7

2020-06-14 Thread mike stern


mike stern  added the comment:

you can at least try it and see for yourself that what I am saying is actually 
true

but never mind I will keep on opening tickets until someone tries it on 2.7 and 
see what I am talking about


From: Redwane Freedom Is-to-Be-With-God 
Sent: Monday, June 15, 2020 2:45 AM
To: Python tracker 
Subject: Re: [issue40981] increment is wrong in 3.7 but not in 2.7

what is rude is to talk to me in an autoritative way like you do
you haven't even checked what I said , I said it working in Python 2.7 and it 
is not in 3.7
and you want to just read me an article.


From: report=bugs.python@roundup.psfhosted.org 
 on behalf of Christian Heimes 

Sent: Monday, June 15, 2020 2:40 AM
To: rskir...@hotmail.com 
Subject: [issue40981] increment is wrong in 3.7 but not in 2.7

Christian Heimes  added the comment:

Python's float are IEE 754 floats for over 25 years and since Python 1.x, maybe 
earlier. IIRC standard is from 1985. It's how CPUs have dealt with floats for 
over 35 years.

By the way it's is incredible rude to keep re-opening a bug and responding on a 
closed bug. Do not reopen the bug again.

--
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue40981>
___

--

___
Python tracker 
<https://bugs.python.org/issue40981>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40981] increment is wrong in 3.7 but not in 2.7

2020-06-14 Thread mike stern


mike stern  added the comment:

what is rude is to talk to me in an autoritative way like you do
you haven't even checked what I said , I said it working in Python 2.7 and it 
is not in 3.7
and you want to just read me an article.


From: report=bugs.python@roundup.psfhosted.org 
 on behalf of Christian Heimes 

Sent: Monday, June 15, 2020 2:40 AM
To: rskir...@hotmail.com 
Subject: [issue40981] increment is wrong in 3.7 but not in 2.7

Christian Heimes  added the comment:

Python's float are IEE 754 floats for over 25 years and since Python 1.x, maybe 
earlier. IIRC standard is from 1985. It's how CPUs have dealt with floats for 
over 35 years.

By the way it's is incredible rude to keep re-opening a bug and responding on a 
closed bug. Do not reopen the bug again.

--
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue40981>
___

--

___
Python tracker 
<https://bugs.python.org/issue40981>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40981] increment is wrong in 3.7 but not in 2.7

2020-06-14 Thread mike stern


mike stern  added the comment:

Christian Heimes you haven't tried it on 2.7 did you ?

--
status: closed -> open

___
Python tracker 
<https://bugs.python.org/issue40981>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40981] increment is wrong in 3.7

2020-06-14 Thread mike stern


mike stern  added the comment:

Christian Heimes why did you close it

--
status: closed -> open

___
Python tracker 
<https://bugs.python.org/issue40981>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40981] increment is wrong in 3.7 but not in 2.7

2020-06-14 Thread mike stern


Change by mike stern :


--
nosy:  -serhiy.storchaka, terry.reedy
title: increment is wrong in 3.7 -> increment is wrong in 3.7 but not in 2.7

___
Python tracker 
<https://bugs.python.org/issue40981>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40981] increment is wrong in 3.7

2020-06-14 Thread mike stern


mike stern  added the comment:

so anybody can close a ticket ?
anybody can say their point of view and close a ticket, is that how it goes?
this is not serious
who is managing this ?
is this how we can trust a programming language? 
it sounds like we are dealing with irresponsible kids here

please don't close this ticket until we understand that there is actually this 
problem in 3.7 and that the problem is fixed

--
nosy:  -SilentGhost
status: closed -> open

___
Python tracker 
<https://bugs.python.org/issue40981>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40981] increment is wrong in 3.7

2020-06-14 Thread mike stern


mike stern  added the comment:

problem actually more serious, it is here print(0.7+0.1) , which gives 
.7999
same thing when adding the .1 increment to 4.8 , 5.1 etc ... 
I am not sure of the pattern but it is acting up with some numbers

who will fix this , this is serious
I wouldn't trust a language behaving crazy like this

the problem is not there in 2.7

why you closed the ticket , who are you

--
status: closed -> open

___
Python tracker 
<https://bugs.python.org/issue40981>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40981] increment is wrong in 3.7

2020-06-14 Thread mike stern


New submission from mike stern :

I noticed i big problem making a simple increment of .1 in python 3.7
using while
the result is wrong

i=0
while i < 1.2:
i += 0.1
print(i)

result

== RESTART: C:/Users/icosf/AppData/Local/Programs/Python/Python37-32/bb.py ==
0.1
0.2
0.30004
0.4
0.5
0.6
0.7
0.7999
0.8999
0.
1.0999
1.2

what the heck is going on, can someone explain to me

--
assignee: terry.reedy
components: IDLE
messages: 371519
nosy: rskir...@hotmail.com, terry.reedy
priority: normal
severity: normal
status: open
title: increment is wrong in 3.7
type: behavior
versions: Python 3.7

___
Python tracker 
<https://bugs.python.org/issue40981>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com