## Expr and floating point numbers

### Expr and floating point numbers

Hi All,

I am trying to use expr to do simple arithmetic; divide a floating point
number by an integer (I know there are bc and dc, was just curious about
that)...The outcome I get is expr: non-numeric argument. I tried quoting the
/ character but I am still getting the same result.

Is expr not accepting floating point numbers or am I doing something wrong
here?

--
George

### Expr and floating point numbers

On Thu, 23 May 2002 15:21:44 +0100,

Quote:>Hi All,

>I am trying to use expr to do simple arithmetic; divide a floating point
>number by an integer (I know there are bc and dc, was just curious about
>that)...The outcome I get is expr: non-numeric argument. I tried quoting the
>/ character but I am still getting the same result.

>Is expr not accepting floating point numbers or am I doing something wrong
>here?

Expr doesn't do floating point.

### Expr and floating point numbers

Quote:> Hi All,

> I am trying to use expr to do simple arithmetic; divide a floating point
> number by an integer (I know there are bc and dc, was just curious about
> that)...The outcome I get is expr: non-numeric argument. I tried quoting
the
> / character but I am still getting the same result.

> Is expr not accepting floating point numbers or am I doing something wrong
> here?

Fyi, ksh93 supports floating point arithmetic directly.

--
David Thompson

### Expr and floating point numbers

>Is expr not accepting floating point numbers or am I doing something wrong
>here?

Have you RTFM?

expr { +, - } expr
arguments.

expr { \*, /, % } expr
Multiplication, division, or remainder of the
integer-valued arguments.
^^^^^^^^^^^^^^

--

Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

### Expr and floating point numbers

Hi Barry,

My manual (bash on SunOS) reads:

ARG1 / ARG2

arithmetic quotient of ARG1 divided by ARG2...No mention about integer or
floating point numbers...

George

> Date: Thu, 23 May 2002 17:58:53 GMT

> Newsgroups: comp.unix.questions
> Subject: Re: Expr and floating point numbers

> >Is expr not accepting floating point numbers or am I doing something wrong
> >here?

> Have you RTFM?

>      expr { +, - } expr
>                     Addition  or  subtraction  of  integer-valued
>                     arguments.

>      expr { \*, /, % } expr
>                     Multiplication, division, or remainder of the
>                     integer-valued arguments.
>                     ^^^^^^^^^^^^^^

> --

> Genuity, Woburn, MA
> *** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
> Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

### Expr and floating point numbers

> > >Is expr not accepting floating point numbers or am I doing something
wrong
> > >here?

> > Have you RTFM?

> >      expr { +, - } expr
> >                     Addition  or  subtraction  of  integer-valued
> >                     arguments.

> >      expr { \*, /, % } expr
> >                     Multiplication, division, or remainder of the
> >                     integer-valued arguments.

> My manual (bash on SunOS) reads:

> ARG1 / ARG2

> arithmetic quotient of ARG1 divided by ARG2...No mention about integer or
> floating point numbers...

of the person you're replying to, like I'm doing here.

Barry's snippets above are from 'man expr', he is pointing
simple RTFM of expr's man page.

--
David Thompson

### Expr and floating point numbers

>> > >Is expr not accepting floating point numbers or am I doing something
> wrong
>> > >here?

>> > Have you RTFM?

>> >      expr { +, - } expr
>> >                     Addition  or  subtraction  of  integer-valued
>> >                     arguments.

>> >      expr { \*, /, % } expr
>> >                     Multiplication, division, or remainder of the
>> >                     integer-valued arguments.

>> My manual (bash on SunOS) reads:

>> ARG1 / ARG2

>> arithmetic quotient of ARG1 divided by ARG2...No mention about integer or
>> floating point numbers...

> of the person you're replying to, like I'm doing here.

> Barry's snippets above are from 'man expr', he is pointing
> out that your original OP regarding expr is answered by a
> simple RTFM of expr's man page.

Unfortunately, not all man pages are that explicit. In the GNU man
page for expr, the word "integer" does not appear once.

--
Chris F.A. Johnson                        http://cfaj.freeshell.org
===================================================================
My code (if any) in this post is copyright 2002, Chris F.A. Johnson
and may be copied under the terms of the GNU General Public License

### Expr and floating point numbers

> > Barry's snippets above are from 'man expr', he is pointing
> > out that your original OP regarding expr is answered by a
> > simple RTFM of expr's man page.

>     Unfortunately, not all man pages are that explicit. In the GNU man
>     page for expr, the word "integer" does not appear once.

What?  GNU man pages don't mention that?  ;)

Somehow that doesn't surprise me.  IMHO, GNU continues to do
a grave disservice by a lack of devotion to man pages.  It's
great that info pages are there, that's not my beef, I find
it a perpetual source of frustration that GNU man pages are
so information poor.  Ie, try 'man date' on GNU.

Chris, do you think other OS's lack this mention of integer
in the expr man page?  I mean, I think GNU is the exception

Btw, OP said he was looking at 'man bash' on SunOS, which is
the wrong place to be looking for information about expr.

--
David Thompson

### Expr and floating point numbers

>> > Barry's snippets above are from 'man expr', he is pointing
>> > out that your original OP regarding expr is answered by a
>> > simple RTFM of expr's man page.

>>     Unfortunately, not all man pages are that explicit. In the GNU man
>>     page for expr, the word "integer" does not appear once.

> What?  GNU man pages don't mention that?  ;)

> Somehow that doesn't surprise me.  IMHO, GNU continues to do
> a grave disservice by a lack of devotion to man pages.  It's
> great that info pages are there, that's not my beef, I find
> it a perpetual source of frustration that GNU man pages are
> so information poor.  Ie, try 'man date' on GNU.

> Chris, do you think other OS's lack this mention of integer
> in the expr man page?  I mean, I think GNU is the exception

All other man pages I've looked at (AT&T SVR3.2, SunOs, Solaris,
FreeBSD, NetBSD), and the POSIX specs, refer to "integer-valued
arguments".

Quote:> Btw, OP said he was looking at 'man bash' on SunOS, which is
> the wrong place to be looking for information about expr.

He probably doesn't know about the "type" builtin command.

--
Chris F.A. Johnson                        http://cfaj.freeshell.org
===================================================================
My code (if any) in this post is copyright 2002, Chris F.A. Johnson
and may be copied under the terms of the GNU General Public License

Give me a hand !

Does anybody know the largest floating point number and the smallest
floating-point number and the base of the floating-point number.

The fortran compiler I am using is ver. 2.1.

thanx.