expr.1 (bd2228ab3ee0cde6831fe446d793fffda2f48503) expr.1 (3102cfe2e21aaea969dcc5245c0b70d9ae643e34)
1.\" -*- nroff -*-
2.\"-
3.\" Copyright (c) 1993 Winning Strategies, Inc.
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:

--- 16 unchanged lines hidden (view full) ---

25.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30.\"
31.\" $FreeBSD$
32.\"
1.\" -*- nroff -*-
2.\"-
3.\" Copyright (c) 1993 Winning Strategies, Inc.
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:

--- 16 unchanged lines hidden (view full) ---

25.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30.\"
31.\" $FreeBSD$
32.\"
33.Dd September 9, 2010
33.Dd February 25, 2012
34.Dt EXPR 1
35.Os
36.Sh NAME
37.Nm expr
38.Nd evaluate expression
39.Sh SYNOPSIS
40.Nm
41.Op Fl e

--- 5 unchanged lines hidden (view full) ---

47.Ar expression
48and writes the result on standard output.
49.Pp
50All operators and operands must be passed as separate arguments.
51Several of the operators have special meaning to command interpreters
52and must therefore be quoted appropriately.
53All integer operands are interpreted in base 10 and must consist of only
54an optional leading minus sign followed by one or more digits (unless
34.Dt EXPR 1
35.Os
36.Sh NAME
37.Nm expr
38.Nd evaluate expression
39.Sh SYNOPSIS
40.Nm
41.Op Fl e

--- 5 unchanged lines hidden (view full) ---

47.Ar expression
48and writes the result on standard output.
49.Pp
50All operators and operands must be passed as separate arguments.
51Several of the operators have special meaning to command interpreters
52and must therefore be quoted appropriately.
53All integer operands are interpreted in base 10 and must consist of only
54an optional leading minus sign followed by one or more digits (unless
55less strict parsing has been enabled for backwards compatibilty with
55less strict parsing has been enabled for backwards compatibility with
56prior versions of
57.Nm
58in
59.Fx ) .
60.Pp
61Arithmetic operations are performed using signed integer math with a
62range according to the C
63.Vt intmax_t

--- 215 unchanged lines hidden (view full) ---

279Backwards compatibility mode performs less strict checks of numeric arguments:
280.Bl -bullet
281.It
282An empty operand string is interpreted as 0.
283.El
284.Bl -bullet
285.It
286Leading white space and/or a plus sign before an otherwise valid positive
56prior versions of
57.Nm
58in
59.Fx ) .
60.Pp
61Arithmetic operations are performed using signed integer math with a
62range according to the C
63.Vt intmax_t

--- 215 unchanged lines hidden (view full) ---

279Backwards compatibility mode performs less strict checks of numeric arguments:
280.Bl -bullet
281.It
282An empty operand string is interpreted as 0.
283.El
284.Bl -bullet
285.It
286Leading white space and/or a plus sign before an otherwise valid positive
287numberic operand are allowed and will be ignored.
287numeric operand are allowed and will be ignored.
288.El
289.Pp
290The extended arithmetic range and overflow checks do not conflict with
291POSIX's requirement that arithmetic be done using signed longs, since
292they only make a difference to the result in cases where using signed
293longs would give undefined behavior.
294.Pp
295According to the

--- 14 unchanged lines hidden ---
288.El
289.Pp
290The extended arithmetic range and overflow checks do not conflict with
291POSIX's requirement that arithmetic be done using signed longs, since
292they only make a difference to the result in cases where using signed
293longs would give undefined behavior.
294.Pp
295According to the

--- 14 unchanged lines hidden ---