Python | Decimal copy_abs() method Last Updated : 05 Sep, 2019 Comments Improve Suggest changes Like Article Like Report Decimal#copy_abs() : copy_abs() is a Decimal class method which returns the absolute Decimal value. Syntax: Decimal.copy_abs() Parameter: Decimal values Return: the absolute Decimal value Code #1 : Example for copy_abs() method Python3 # Python Program explaining # copy_abs() method # loading decimal library from decimal import * # Initializing a decimal value a = Decimal(-1) b = Decimal('0.142857') # printing Decimal values print ("Decimal value a : ", a) print ("Decimal value b : ", b) # Using Decimal.copy_abs() method print ("\n\nDecimal a with copy_abs() method : ", a.copy_abs()) print ("Decimal b with copy_abs() method : ", b.copy_abs()) Output : Decimal value a : -1 Decimal value b : 0.142857 Decimal a with copy_abs() method : 1 Decimal b with copy_abs() method : 0.142857 Code #2 : Example for copy_abs() method Python3 # Python Program explaining # copy_abs() method # loading decimal library from decimal import * # Initializing a decimal value a = Decimal('-3.14') b = Decimal('321e + 5') # printing Decimal values print ("Decimal value a : ", a) print ("Decimal value b : ", b) # Using Decimal.copy_abs() method print ("\n\nDecimal a with copy_abs() method : ", a.copy_abs()) print ("Decimal b with copy_abs() method : ", b.copy_abs()) Output : Decimal value a : -3.14 Decimal value b : 3.21E+7 Decimal a with copy_abs() method : 3.14 Decimal b with copy_abs() method : 3.21E+7 Comment More infoAdvertise with us Next Article Python | Decimal copy_abs() method N noobestars101 Follow Improve Article Tags : Python Practice Tags : python Similar Reads Python | Decimal copy_sign() method Decimal#copy_sign() : copy_sign() is a Decimal class method which returns the copy of the first Decimal value with the sign set to be the same as the sign of the second Decimal value. Syntax: Decimal.copy_sign() Parameter: Decimal values Return: the copy of the first Decimal value with the sign set 2 min read Python | Decimal compare() method Decimal#compare() : compare() is a Decimal class method which compares the two Decimal values. Syntax: Decimal.compare() Parameter: Decimal values Return: 1 - if a > b -1 - if a < b 0 - if a = b Code #1 : Example for compare() method Python3 # Python Program explaining # compare() method # loa 2 min read Python | Decimal copy_negate() method Decimal#copy_negate() : copy_negate() is a Decimal class method which returns the negation of Decimal value. Syntax: Decimal.copy_negate() Parameter: Decimal values Return: the negation of Decimal value Code #1 : Example for copy_negate() method Python3 # Python Program explaining # copy_negate() me 2 min read Python | Decimal adjusted() method Decimal#adjusted() : adjusted() is a Decimal class method which returns the adjusted exponent after shifting out the coefficientâs rightmost digits until only the lead digit remains Syntax: Decimal.adjusted() Parameter: Decimal values Return: the adjusted exponent after shifting out the coefficientâ 2 min read Python | Decimal canonical() method Decimal#canonical() : canonical() is a Decimal class method which returns the canonical encoding of the Decimal value. Syntax: Decimal.canonical() Parameter: Decimal values Return: the canonical encoding of the Decimal value. Code #1 : Example for canonical() method Python3 # Python Program explaini 2 min read Python | Decimal compare_total() method Decimal#compare_total() : compare_total() is a Decimal class method which compares the two Decimal values using their abstract representation rather than their numerical value. Syntax: Decimal.compare_total() Parameter: Decimal values Return: 1 - if a > b -1 - if a < b 0 - if a = b Code #1 : E 2 min read Python | Decimal min() method Decimal#min() : min() is a Decimal class method which compares the two Decimal values and return the min of two. Syntax: Decimal.min() Parameter: Decimal values Return: the min of two. Code #1 : Example for min() method Python3 # Python Program explaining # min() method # loading decimal library fro 2 min read Python | Decimal max() method Decimal#max() : max() is a Decimal class method which compares the two Decimal values and return the max of two. Syntax: Decimal.max() Parameter: Decimal values Return: the max of two. Code #1 : Example for max() method Python3 # Python Program explaining # max() method # loading decimal library fro 2 min read Python | Decimal compare_signal() method Decimal#compare_signal() : compare_signal() is a Decimal class method which compares th two Decimal values, except for the NaN values. Syntax: Decimal.compare_signal()Parameter: Decimal valuesReturn: 1 - if a > b -1 - if a < b 0 - if a = b Code #1 : Example for compare_signal() method Python 2 min read Python | Decimal sqrt() method Decimal#sqrt() : sqrt() is a Decimal class method which returns the Square root of a non-negative number to context precision. Syntax: Decimal.sqrt() Parameter: Decimal values Return: the Square root of a non-negative number to context precision. Code #1 : Example for sqrt() method Python3 # Python 2 min read Like