Bug 210484

Summary: dc doesn't enforce precision consistently (sometimes)
Product: [Fedora] Fedora Reporter: JW <ohtmvyyn>
Component: bcAssignee: Zdenek Prikryl <zprikryl>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 5   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-07-26 08:33:28 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description JW 2006-10-12 14:46:35 UTC
Description of problem:
dc doesn't enforce precision.


Version-Release number of selected component (if applicable):
bc-1.06-19.2.1

How reproducible:
Always

Steps to Reproduce:
1.echo "k 0 1 2 / p" | dc
2.echo "k 0 1 0.4 * p" | dc
3.
  
Actual results:
1. "0"
2. ".4"

Expected results:
1. "0"
2. "0"

Additional info:
If precision setting is meaningless (as it appears to be in case of
multiplication) then a command should be available to actually enforce the
desired precision.

Comment 1 Zdenek Prikryl 2007-07-26 08:33:28 UTC
FC5 has now been EOL'd.

This is not a bug but a feature. Work with precisions is described at
http://www.gnu.org/software/bc/manual/dc-1.05/html_mono/dc.html. Operation "/"
takes care about precision value which is set by "k". Others operations (like
"*") calculates precision from operands (sometimes co-operates with precision
value).

As I see in source code, precisions are calculated exactly as is described in
doc above.

Zdenek.