~ubuntu-branches/ubuntu/trusty/bc/trusty

« back to all changes in this revision

Viewing changes to FAQ

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2007-12-05 12:24:03 UTC
  • mfrom: (3.1.2 lenny)
  • Revision ID: james.westby@ubuntu.com-20071205122403-rv1a7x90ktu1wl95
Tags: 1.06.94-3ubuntu1
* Merge with Debian; remaining changes:
  - Make bc/dc notice read and write errors on its input and output.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
"fixed, but arbitrary" mantissa and so multiplying two floats will end
16
16
up dropping digits BC must calculate.
17
17
 
 
18
2) The code "ibase=16; obase=10; FF" outputs FF, not 255.  Isn't this
 
19
   a bug?
 
20
 
 
21
No.  ibase changed the input base at that point.  The 10 is then in
 
22
base 16 and thus is the value 16.  Therefore, both ibase and obase
 
23
are 16 (decimal).  And FF (base 16) on input is printed as FF (base 16)
 
24
on output.  So how can one get 255?  First, single digit numbers are
 
25
not converted using ibase.  So A is always 10 (decimal).  The following
 
26
code will always work.  "ibase=F+1; obase=A; FF" and that always prints
 
27
255.