Oh, thanks. Didn't think of that.
On Tue, Jan 7, 2020, 7:53 PM Michael Torrie wrote:
> On 1/7/20 8:46 PM, Shashank Tiwari wrote:
> > Yes, I tried this and it worked. I was wondering if I could use the
> output
> > of pow (or math.pow).
>
> Sure:
>
> pow(Decimal('2.2'), Decimal('0.45'))
>
> --
>
On 1/7/20 8:46 PM, Shashank Tiwari wrote:
> Yes, I tried this and it worked. I was wondering if I could use the output
> of pow (or math.pow).
Sure:
pow(Decimal('2.2'), Decimal('0.45'))
--
https://mail.python.org/mailman/listinfo/python-list
Thanks everyone. Much appreciated.
On Tue, Jan 7, 2020, 7:46 PM Shashank Tiwari
wrote:
> Yes, I tried this and it worked. I was wondering if I could use the output
> of pow (or math.pow).
>
> On Tue, Jan 7, 2020, 7:41 PM Michael Torrie wrote:
>
>> On 1/7/20 8:18 PM, Shashank Tiwari wrote:
>> >
Yes, I tried this and it worked. I was wondering if I could use the output
of pow (or math.pow).
On Tue, Jan 7, 2020, 7:41 PM Michael Torrie wrote:
> On 1/7/20 8:18 PM, Shashank Tiwari wrote:
> > Thanks Chris. What if it's pow(2.2,0.45)?
>
> Why not do some more experimentation:
>
> >>> import d
On 1/7/20 8:18 PM, Shashank Tiwari wrote:
> Thanks Chris. What if it's pow(2.2,0.45)?
Why not do some more experimentation:
>>> import decimal
>>> a = decimal.Decimal('2.2')
>>> b = decimal.Decimal('0.45')
>>> a ** b
Decimal('1.425903734234490793207619170')
Is this what you mean? I'm sure there
On Wed, Jan 8, 2020 at 2:18 PM Shashank Tiwari wrote:
>
> Thanks Chris. What if it's pow(2.2,0.45)?
>
Initialize your Decimals from strings, as you were already advised,
and do the calculation in Decimals.
Or just use floats, since it's likely to be at least as accurate.
ChrisA
--
https://mail
Thanks Chris. What if it's pow(2.2,0.45)?
On Tue, Jan 7, 2020, 6:40 PM Chris Angelico wrote:
> On Wed, Jan 8, 2020 at 1:37 PM Shashank Tiwari
> wrote:
> >
> > Thanks Rob.
> >
> > How would one initialize a Decimal with something like pow(2,256)?
> >
>
> Easy, just initialize it with an integer:
On Wed, Jan 8, 2020 at 1:37 PM Shashank Tiwari wrote:
>
> Thanks Rob.
>
> How would one initialize a Decimal with something like pow(2,256)?
>
Easy, just initialize it with an integer:
>>> Decimal(2**256)
Decimal('115792089237316195423570985008687907853269984665640564039457584007913129639936')
Thanks Rob.
How would one initialize a Decimal with something like pow(2,256)?
On Tue, Jan 7, 2020 at 5:25 PM Rob Gaddi
wrote:
> On 1/7/20 3:47 PM, Shashank Tiwari wrote:
> > In Python3 an operation as follows:
> 10135.1941 * (10**8)
> > gives the result: 101351941.0001
> >
> > Similar
On 1/7/20 3:47 PM, Shashank Tiwari wrote:
In Python3 an operation as follows:
10135.1941 * (10**8)
gives the result: 101351941.0001
Similarly, using the pow function also gives the same overflow/underflow
error.
10135.1941 * pow(10,8)
101351941.0001
Like multiplication, division of
In Python3 an operation as follows:
>>> 10135.1941 * (10**8)
gives the result: 101351941.0001
Similarly, using the pow function also gives the same overflow/underflow
error.
>>> 10135.1941 * pow(10,8)
101351941.0001
Like multiplication, division of large or very small floating point numbe
11 matches
Mail list logo