Python | Decimal max() method Last Updated : 17 Sep, 2019 Comments Improve Suggest changes Like Article Like Report 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 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.max() method print ("\n\nDecimal a with max() method : ", a.max(a)) print ("Decimal a with max() method : ", a.max(b)) print ("Decimal b with max() method : ", b.max(a)) Output : Decimal value a : -1 Decimal value b : 0.142857 Decimal a with max() method : -1 Decimal a with max() method : 0.142857 Decimal b with max() method : 0.142857 Code #2 : Example for max() method Python3 # Python Program explaining # max() 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.max() method print ("\n\nDecimal a with max() method : ", a.max(a)) print ("Decimal a with max() method : ", a.max(b)) print ("Decimal b with max() method : ", b.max(a)) Output : Decimal value a : -3.14 Decimal value b : 3.21E+7 Decimal a with max() method : -3.14 Decimal a with max() method : 3.21E+7 Decimal b with max() method : 3.21E+7 Comment More infoAdvertise with us Next Article Python | Decimal max() method N noobestars101 Follow Improve Article Tags : Python Python-Functions Practice Tags : pythonpython-functions Similar Reads Python | Decimal max_mag() method Decimal#max_mag() : max_mag() is a Decimal class method which compares the two Decimal values and return the max of two, with their sign ignored. Syntax: Decimal.max_mag() Parameter: Decimal values Return: the max_mag of two, with their sign ignored. Code #1 : Example for max_mag() method Python3 # 2 min read Python | Decimal exp() method Decimal#exp() : exp() is a Decimal class method which returns the value of the (natural) exponential function e**x at the given number Syntax: Decimal.exp() Parameter: Decimal values Return: the value of the (natural) exponential function e**x at the given number Code #1 : Example for exp() method P 2 min read Python | Decimal ln() method Decimal#ln() : ln() is a Decimal class method which returns the natural (base e) logarithm of the Decimal value. Syntax: Decimal.ln() Parameter: Decimal values Return: the natural (base e) logarithm of the Decimal value. Code #1 : Example for ln() method Python3 # Python Program explaining # ln() me 2 min read Python | Decimal min_mag() method Decimal#min_mag() : min_mag() is a Decimal class method which compares the two Decimal values and return the minimum of two, with their sign ignored. Syntax: Decimal.min_mag() Parameter: Decimal values Return: minimum of two, with their sign ignored. Code #1 : Example for min_mag() method Python3 # 2 min read Python | Decimal log10() method Decimal#log10() : log10() is a Decimal class method which returns the base ten logarithm of the Decimal value. Syntax: Decimal.log10() Parameter: Decimal values Return: the base ten logarithm of the Decimal value. Code #1 : Example for log10() method Python3 # Python Program explaining # log10() met 2 min read Like