From owner-freebsd-arch@freebsd.org  Tue Jan  8 05:57:48 2019
Return-Path: <owner-freebsd-arch@freebsd.org>
Delivered-To: freebsd-arch@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4E861149048E
 for <freebsd-arch@mailman.ysv.freebsd.org>;
 Tue,  8 Jan 2019 05:57:48 +0000 (UTC) (envelope-from devin@shxd.cx)
Received: from shxd.cx (mail.shxd.cx [64.201.244.140])
 (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 5DFEF70014;
 Tue,  8 Jan 2019 05:57:47 +0000 (UTC) (envelope-from devin@shxd.cx)
Received: from [76.77.180.168] (port=57277 helo=eskarina.lan)
 by shxd.cx with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.77 (FreeBSD))
 (envelope-from <devin@shxd.cx>)
 id 1ggkO1-0007MW-BE; Mon, 07 Jan 2019 21:57:13 -0800
Content-Type: text/plain;
	charset=us-ascii
Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\))
Subject: Re: GNU-compatible, BSD-licensed bc
From: Devin Teske <dteske@FreeBSD.org>
In-Reply-To: <CAF=dzRNYxYf7P8q7mZo=Tc6a+fTYsARGpG0=ZTvBP1ESLPBLOg@mail.gmail.com>
Date: Mon, 7 Jan 2019 21:57:43 -0800
Cc: Devin Teske <dteske@FreeBSD.org>, cem@freebsd.org,
 "freebsd-arch@freebsd.org" <freebsd-arch@freebsd.org>
Content-Transfer-Encoding: 7bit
Message-Id: <61F802DC-2E59-4E0A-955D-899EBD7874A1@FreeBSD.org>
References: <CAF=dzRNnurahLBOaKgq8_bDXNuM8biYPFbj6F2vp0t58Ejp8bg@mail.gmail.com>
 <8FFA4578-0BAE-4F9F-8A06-AE83283BDEA4@FreeBSD.org>
 <CAG6CVpXam0bJD9B7n0xDQiRF=ZTeH0hN7wd8f8fDGyMSsCwh0w@mail.gmail.com>
 <CAF=dzRNYxYf7P8q7mZo=Tc6a+fTYsARGpG0=ZTvBP1ESLPBLOg@mail.gmail.com>
To: Gavin Howard <gavin.d.howard@gmail.com>
X-Mailer: Apple Mail (2.3445.9.1)
Sender: devin@shxd.cx
X-Rspamd-Queue-Id: 5DFEF70014
X-Spamd-Bar: +++
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [3.93 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[];
 RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[];
 MV_CASE(0.50)[]; MX_GOOD(-0.01)[cached: mail.shxd.cx];
 FORGED_SENDER(0.30)[dteske@FreeBSD.org,devin@shxd.cx];
 FREEMAIL_TO(0.00)[gmail.com];
 IP_SCORE(0.24)[ip: (0.68), ipnet: 64.201.240.0/20(0.34), asn: 36734(0.27),
 country: US(-0.08)]; R_DKIM_NA(0.00)[];
 ASN(0.00)[asn:36734, ipnet:64.201.240.0/20, country:US];
 MIME_TRACE(0.00)[0:+];
 FROM_NEQ_ENVFROM(0.00)[dteske@FreeBSD.org,devin@shxd.cx];
 ARC_NA(0.00)[]; MID_RHS_MATCH_FROM(0.00)[];
 FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4];
 NEURAL_SPAM_SHORT(0.68)[0.678,0]; TAGGED_RCPT(0.00)[];
 MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org];
 AUTH_NA(1.00)[]; NEURAL_SPAM_MEDIUM(0.33)[0.326,0];
 TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_SPAM_LONG(1.00)[0.995,0];
 R_SPF_NA(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]
X-BeenThere: freebsd-arch@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Discussion related to FreeBSD architecture <freebsd-arch.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/freebsd-arch>,
 <mailto:freebsd-arch-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-arch/>
List-Post: <mailto:freebsd-arch@freebsd.org>
List-Help: <mailto:freebsd-arch-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/freebsd-arch>,
 <mailto:freebsd-arch-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 08 Jan 2019 05:57:48 -0000



> On Jan 7, 2019, at 4:42 PM, Gavin Howard <gavin.d.howard@gmail.com> wrote:
> 
> On Mon, Jan 7, 2019 at 5:38 PM Conrad Meyer <cem@freebsd.org> wrote:
>> 
>> On Mon, Jan 7, 2019 at 4:00 PM Devin Teske <dteske@freebsd.org> wrote:
>>> How do you handle arbitrary arithmetic precision?
>> 
>> Looks like https://github.com/gavinhoward/bc/blob/master/src/num.c .
> 
> That is correct. Because this bc is meant to help bootstrap the Linux
> kernel and have no dependencies other than POSIX 2008, I wrote my own.

Impressive. It might be worth turning this into a library itself.


> Also, the POSIX bc standard mandates doing math in decimal. OpenSSL
> would not be smart if they did that.

Not sure I understand what you mean here.


> There are also a few
> peculiarities with the POSIX bc standard that (more or less) require a
> standalone implementation.
> 

How hard would it be to convert a bn(3)-based library to use your code?
Would there be any performance impact -- I've benchmarked bn(3) to
be pretty fast.


> Also, right now I am working on getting a release candidate out that
> will enable me to make a quick port that Stefan could use as a jumping
> off point. My build system changed between 1.0 and now, and I would
> like to be able to test it.
> 

Cool. Looking forward to it.
-- 
Cheers,
Devin