Ruby | BigDecimal quo() function
BigDecimal#quo() : quo() is a BigDecimal class method which divides the two BigDecimal values.
Syntax: BigDecimal.quo()
Parameter: BigDecimal values
Return: Divides the two BigDecimal values.
Example #1 : Example for quo() method
# Ruby code for BigDecimal.quo() method # loading library require 'bigdecimal' # declaring bigdecimal a = 42 . 1 ** 13 # declaring bigdecimal b = -BigDecimal( "10" ) # declaring bigdecimal c = -( 22 ** 7 . 1 ) * 10 # a puts "BigDecimal a quo b : #{a.quo(b)}\n\n" # b puts "BigDecimal b quo c : #{b.quo(c)}\n\n" # c puts "BigDecimal a quo c : #{c.quo(a)}\n\n" |
Output :
BigDecimal a quo b : -0.1305170490200644E21 BigDecimal b quo c : 0.294305898374113860903919913595274271160955693E-9 BigDecimal a quo c : -2.603357363878968e-11
Example #2 : Example for quo() method
# Ruby code for BigDecimal.quo() method # loading library require 'bigdecimal' # declaring bigdecimal a = 12 ** 12 - 27 # declaring bigdecimal b = BigDecimal( '10' )-( 22 ** 7 . 1 ) ** 10 # declaring bigdecimal c = BigDecimal( '-3' ) # a puts "BigDecimal a quo b : #{a.quo(b)}\n\n" # b puts "BigDecimal b quo c : #{b.quo(c)}\n\n" # c puts "BigDecimal a quo c : #{c.quo(a)}\n\n" |
Output :
BigDecimal a quo b : -0.43467495135664927751543107109605140241443591953770701070858615126212074067246983224430195700021040971296977257849892016846008052931414945402329722017988217346432784277797794204259881413316908809142E-82 BigDecimal b quo c : 0.68373700243528799999999999999999999999999999999999999999999999999999999999999999999999999999996666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666667E95 BigDecimal a quo c : -0.336469964354864161144849420060934E-12