python use getcontext

Solutions on MaxInterview for python use getcontext by the best coders in the world

showing results for - "python use getcontext"
Lya
04 Jul 2018
1from decimal import getcontext, Decimal
2
3ctx=getcontext()
4num=Decimal('1.1')
5num**4  //Decimal('1.4641')
6ctx.prec=4  //Set new precision
7print(num**4)