On 18/04/2020 15:29, Grant Edwards wrote:
On 2020-04-18, Souvik Dutta wrote:
I literally tried it!!! And it did not stop because I did not get any 1.0
rather I got 0.999 But why does this happen. This is a simple math
which according to normal human logic should give perfect numbers w
On 4/21/20 9:43 AM, Chris Angelico wrote:
> Right. Now try diagnosing weird bugs in floating-point calculations,
> and you aren't sure if it's because sometimes you have 53 bits of
> mantissa and sometimes only 52.
>
And sometimes only 1. The smallest positive floating point number has
only 1 signi
On Tue, Apr 21, 2020 at 11:31 PM Pieter van Oostrum
wrote:
>
> Chris Angelico writes:
>
> > On Tue, Apr 21, 2020 at 6:07 AM Schachner, Joseph
> > wrote:
> >>
> >> 16 base 10 digits / log base10( 2) = 53.1508495182 bits. Obviously,
> >> fractional bits don't exist, so 53 bits. If you note that th
Chris Angelico writes:
> On Tue, Apr 21, 2020 at 6:07 AM Schachner, Joseph
> wrote:
>>
>> 16 base 10 digits / log base10( 2) = 53.1508495182 bits. Obviously,
>> fractional bits don't exist, so 53 bits. If you note that the first
>> non-zero digit as 4, and the first digit after the 15 zeroes was
On 4/20/20 4:19 PM, Chris Angelico wrote:
> On Tue, Apr 21, 2020 at 6:07 AM Schachner, Joseph
> wrote:
>> 16 base 10 digits / log base10( 2) = 53.1508495182 bits. Obviously,
>> fractional bits don't exist, so 53 bits. If you note that the first non-zero
>> digit as 4, and the first digit after
On Tue, Apr 21, 2020 at 6:07 AM Schachner, Joseph
wrote:
>
> 16 base 10 digits / log base10( 2) = 53.1508495182 bits. Obviously,
> fractional bits don't exist, so 53 bits. If you note that the first non-zero
> digit as 4, and the first digit after the 15 zeroes was 2, then you got an
> extra
?
--- Joseph S.
-Original Message-
From: Pieter van Oostrum
Sent: Sunday, April 19, 2020 7:49 AM
To: python-list@python.org
Subject: Re: Floating point problem
"R.Wieser" writes:
> Souvik,
>
>> I have one question here. On using print(f"{c:.32f}") where c=
"R.Wieser" writes:
> Souvik,
>
>> I have one question here. On using print(f"{c:.32f}") where c= 2/5
>> instead of getting 32 zeroes I got some random numbers. The exact
>> thing is 0.40002220446049250313 Why do I get
>> this and not 32 zeroes?
>
> Simple answer ? The conversion rou
On Sun, Apr 19, 2020 at 4:26 AM Grant Edwards wrote:
>
> On 2020-04-18, Souvik Dutta wrote:
> > I literally tried it!!! And it did not stop because I did not get any 1.0
> > rather I got 0.999 But why does this happen. This is a simple math
> > which according to normal human logic should
On 2020-04-18, Dennis Lee Bieber wrote:
> At the very least, one was taught to not test for equality of two
> floating point values (which also implies one did not test for the
> negation of equality). One either tested for difference
> (greater/less than) or for a delta between values being less
On 2020-04-18, Souvik Dutta wrote:
> I literally tried it!!! And it did not stop because I did not get any 1.0
> rather I got 0.999 But why does this happen. This is a simple math
> which according to normal human logic should give perfect numbers which are
> not endless. Then why does a c
Le 18/04/2020 à 15:07, Souvik Dutta a écrit :
I have one question here. On using print(f"{c:.32f}") where c= 2/5 instead
of getting 32 zeroes I got some random numbers. The exact thing is
0.40002220446049250313
Why do I get this and not 32 zeroes?
2/5 = 0.0110011001100110011001..
I am really enlightened by the amount of knowledge I received from a
question that seemed so little to me. 😅
On Sat, 18 Apr 2020, 8:08 pm Souvik Dutta Hmm understood.
>
> Souvik flutter dev
>
> On Sat, Apr 18, 2020, 7:36 PM Chris Angelico wrote:
>
> > On Sun, Apr 19, 2020 at 12:03 AM Souvik Dutt
Hmm understood.
Souvik flutter dev
On Sat, Apr 18, 2020, 7:36 PM Chris Angelico wrote:
> On Sun, Apr 19, 2020 at 12:03 AM Souvik Dutta
> wrote:
> >
> > I literally tried it!!! And it did not stop because I did not get any 1.0
> > rather I got 0.999 But why does this happen. This is a s
Hmmm sorry please forgive me. I only did that because the question was
relevant. Please forgive me. Sorry again.
Souvik flutter dev
On Sat, Apr 18, 2020, 7:52 PM DL Neil via Python-list <
python-list@python.org> wrote:
> On 19/04/20 1:51 AM, Souvik Dutta wrote:
> > I literally tried it!!! And it
On 19/04/20 1:51 AM, Souvik Dutta wrote:
I literally tried it!!! And it did not stop because I did not get any
1.0 rather I got 0.999 But why does this happen. This is a
simple math which according to normal human logic should give perfect
numbers which are not endless. Then why does a
On Sun, Apr 19, 2020 at 12:03 AM Souvik Dutta wrote:
>
> I literally tried it!!! And it did not stop because I did not get any 1.0
> rather I got 0.999 But why does this happen. This is a simple math
> which according to normal human logic should give perfect numbers which are
> not endles
I literally tried it!!! And it did not stop because I did not get any 1.0
rather I got 0.999 But why does this happen. This is a simple math
which according to normal human logic should give perfect numbers which are
not endless. Then why does a computer behave so differently?
On Sat, 18 A
On Sun, 19 Apr 2020 01:25:00 +1200
DL Neil via Python-list wrote:
> On 19/04/20 1:07 AM, Souvik Dutta wrote:
> > I have one question here. On using print(f"{c:.32f}") where c= 2/5 instead
> > of getting 32 zeroes I got some random numbers. The exact thing is
> > 0.40002220446049250313
On 19/04/20 1:07 AM, Souvik Dutta wrote:
I have one question here. On using print(f"{c:.32f}") where c= 2/5 instead
of getting 32 zeroes I got some random numbers. The exact thing is
0.40002220446049250313
Why do I get this and not 32 zeroes?
Approximating decimal numbers as binary
I have one question here. On using print(f"{c:.32f}") where c= 2/5 instead
of getting 32 zeroes I got some random numbers. The exact thing is
0.40002220446049250313
Why do I get this and not 32 zeroes?
On Fri, 17 Apr, 2020, 6:25 pm ast, wrote:
> Le 17/04/2020 à 13:40, Aakash Jana a é
Le 17/04/2020 à 13:40, Aakash Jana a écrit :
I am running python 3.8 only but my issue is I need more zeroes after my
result.
I want 2/5 = 0.40
But I am only getting 0.4
f"{2/5:.6f}"
'0.40'
--
https://mail.python.org/mailman/listinfo/python-list
Aakash Jana wrote:
> I am running python 3.8 only but my issue is I need more zeroes after my
> result.
> I want 2/5 = 0.40
> But I am only getting 0.4
This is either a formatting problem
>>> value = 0.4
>>> print(f"{value:10.6f}")
0.40
or -- if you want to *calculate* with a fixed pr
On 17/04/2020 12:40, Aakash Jana wrote:
I am running python 3.8 only but my issue is I need more zeroes after my
result.
I want 2/5 = 0.40
But I am only getting 0.4
When you just print or display a floating point number, Python only uses
as many digits as needed if the answer happens to be
I am running python 3.8 only but my issue is I need more zeroes after my
result.
I want 2/5 = 0.40
But I am only getting 0.4
On Fri, 17 Apr 2020, 5:08 pm Peter Otten <__pete...@web.de wrote:
> Aakash Jana wrote:
>
> > I am calculating couple of ratios and according to the problem there must
>
Aakash Jana wrote:
> I am calculating couple of ratios and according to the problem there must
> be a 6 decimal precision. But when I print the result I only get one 0.
> E.g:- 2 / 5 = 0.40 but I am only getting 0.4
Make sure that you are using Python 3, not Python 2 or use at least one
floa
26 matches
Mail list logo