Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Mar 2011 03:48:52 -0700 (PDT)
From:      Dan Strick <mla_strick@att.net>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        dan@mist.nodomain
Subject:   bin/155886: bc sometimes mangles hexidecimal numbers
Message-ID:  <201103231048.p2NAmqMY004449@mist.nodomain>
Resent-Message-ID: <201103231110.p2NBA1YB090595@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         155886
>Category:       bin
>Synopsis:       bc sometimes mangles hexidecimal numbers
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Mar 23 11:10:01 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Dan Strick
>Release:        FreeBSD 8.1-RELEASE i386
>Organization:
none
>Environment:
System: FreeBSD mist 8.1-RELEASE FreeBSD 8.1-RELEASE #0: Sat Aug 14 09:15:14 PDT 2010 root@mist:/usr/src/sys/i386/compile/MIST i386
>Description:
	The bc program sometimes mangles hexidecimal numbers.
	I don't really understand what it is doing, but it seems to be
	incorrect and when it does this it is worse than useless.
	See below for a reasonably simple example.
>How-To-Repeat:
	Enter the following, beginning at a shell prompt:
		% /usr/bin/bc
		obase=16
		ibase=16
		.1F9A6B50B0F27C00

	The bc program responds:
		bc 1.06
		Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
		This is free software with ABSOLUTELY NO WARRANTY.
		For details type `warranty'. 
		.1F9A6B50B0F27B

	In other words, I enter the number:
		.1F9A6B50B0F27C00
	and it responds:
		.1F9A6B50B0F27B

	I did a little more experimentation.  If I set ibase to a
	value greater than decimal 10 and enter:
		.1
	the bc program responds:
		0

	The value of obase does not seem to matter.

>Fix:
	unknown
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201103231048.p2NAmqMY004449>