Skip to main content
Commonmark migration
Source Link

As per the bc doc:

expr / expr

 

The result of the expression is the quotient of the two expressions. The scale of the result is the value of the variable scale.

So use scale=0 to have an integer division:

>bc <<<'scale=2; 8/3' 2.66 >bc <<<'scale=0; 8/3' 2 

As per the bc doc:

expr / expr

 

The result of the expression is the quotient of the two expressions. The scale of the result is the value of the variable scale.

So use scale=0 to have an integer division:

>bc <<<'scale=2; 8/3' 2.66 >bc <<<'scale=0; 8/3' 2 

As per the bc doc:

expr / expr

The result of the expression is the quotient of the two expressions. The scale of the result is the value of the variable scale.

So use scale=0 to have an integer division:

>bc <<<'scale=2; 8/3' 2.66 >bc <<<'scale=0; 8/3' 2 
Source Link
xenoid
  • 9.3k
  • 4
  • 29
  • 52

As per the bc doc:

expr / expr

The result of the expression is the quotient of the two expressions. The scale of the result is the value of the variable scale.

So use scale=0 to have an integer division:

>bc <<<'scale=2; 8/3' 2.66 >bc <<<'scale=0; 8/3' 2