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
require 'bigdecimal'
a = 42 . 1 ** 13
b = -BigDecimal( "10" )
c = -( 22 ** 7 . 1 ) * 10
puts "BigDecimal a quo b : #{a.quo(b)}\n\n"
puts "BigDecimal b quo c : #{b.quo(c)}\n\n"
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
require 'bigdecimal'
a = 12 ** 12 - 27
b = BigDecimal( '10' )-( 22 ** 7 . 1 ) ** 10
c = BigDecimal( '-3' )
puts "BigDecimal a quo b : #{a.quo(b)}\n\n"
puts "BigDecimal b quo c : #{b.quo(c)}\n\n"
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
Last Updated :
05 Dec, 2019
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...