Changeset View
Changeset View
Standalone View
Standalone View
head/usr.bin/dc/dc.1
Show All 29 Lines | |||||
.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | .\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||||
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||||
.\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | .\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||||
.\" POSSIBILITY OF SUCH DAMAGE. | .\" POSSIBILITY OF SUCH DAMAGE. | ||||
.\" | .\" | ||||
.\" @(#)dc.1 8.1 (Berkeley) 6/6/93 | .\" @(#)dc.1 8.1 (Berkeley) 6/6/93 | ||||
.\" | .\" | ||||
.Dd February 27, 2017 | .Dd December 5, 2017 | ||||
.Dt DC 1 | .Dt DC 1 | ||||
.Os | .Os | ||||
.Sh NAME | .Sh NAME | ||||
.Nm dc | .Nm dc | ||||
.Nd desk calculator | .Nd desk calculator | ||||
.Sh SYNOPSIS | .Sh SYNOPSIS | ||||
.Nm | .Nm | ||||
.Op Fl hxV | .Op Fl hxV | ||||
▲ Show 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | |||||
divided (/), | divided (/), | ||||
remaindered (%), | remaindered (%), | ||||
divided and remaindered (~), | divided and remaindered (~), | ||||
or exponentiated (^). | or exponentiated (^). | ||||
The two entries are popped off the stack; | The two entries are popped off the stack; | ||||
the result is pushed on the stack in their place. | the result is pushed on the stack in their place. | ||||
Any fractional part of an exponent is ignored. | Any fractional part of an exponent is ignored. | ||||
.Pp | .Pp | ||||
For addition and subtraction, the scale of the result is the maximum | For addition, subtraction, and remainder, the scale of the result is the | ||||
of scales of the operands. | maximum of scales of the operands. | ||||
For division the scale of the result is defined | For division the scale of the result is defined | ||||
by the scale set by the | by the scale set by the | ||||
.Ic k | .Ic k | ||||
operation. | operation. | ||||
For multiplication, the scale is defined by the expression | For multiplication, the scale is defined by the expression | ||||
.Sy min(a+b,max(a,b,scale)) , | .Sy min(a+b,max(a,b,scale)) , | ||||
where | where | ||||
.Sy a | .Sy a | ||||
▲ Show 20 Lines • Show All 407 Lines • Show Last 20 Lines |