How do you test if a string is a number?
Trying to do something like this:
x="AS"
if( x is not a number ); then
x=0
fi
Because I want to do number arithmetic with x. (3 Replies)
morning guys and gals,
I am haveing a problem, a friend helped me out with this script but i dont know how to add incrementing number for each movie in movie.list. this is what i have so far. any assistance would be great.
I have removed the GT and LT symbols so you can see what is going on... (5 Replies)
I would like to change the format of an integer type number adding zeros to the left of it in a script in bash. For example
number=1
echo $number
00001
Thanks (3 Replies)
I have a txt file as database. when i run my program what it does is it ask me for 3 name and stored in the file as
name1:name2:name3:1
when u enter 3 name it add those in file as above format and add 1 at the end. I what i want is if i enter same names again it changes that 1 to 2 and so... (3 Replies)
Hello All,
In the below script i am trying to check and list the file names, get the last file with highest version number and then increment the version number when i create another file. Example: file1 is COBANK_v1.xml and file2 i want to put it as COBANK_v2.xml, to achieve this i am using awk... (15 Replies)
I have number in file which contains date and serial number:
2013101000.
The last two digits are serial number (00). So maximum of serial number is 100.
After reaching 100 it becomes 00 with incrementing 10 which is day with max 31.
after reaching 31 it becomes 00 and increments 10... (31 Replies)
Hi,
This is my first post here.
I am using cygwin on Windows 7.
I am starting with a data file with filename "name_1.ext", like "20180831_snapgenotypes_1.csv".
The "_1" before ".ext" is a version number. Integers (0-99) are sufficient. They don't have to be like "1.0.0".
The filename may... (2 Replies)
Hi
I am unix newbie looking for a unix bash script that can make it easier to do my code work. we have a code number for each code block that we want to incrementally assign. We have 10000 of these and it is very laborious to do this one by one.
so what we want is start from the top of the... (4 Replies)
Discussion started by: chamajid
4 Replies
LEARN ABOUT BSD
infnan
INFNAN(3M)INFNAN(3M)NAME
infnan - signals invalid floating-point operations on a VAX (temporary)
SYNOPSIS
#include <math.h>
double infnan(iarg)
int iarg;
DESCRIPTION
At some time in the future, some of the useful properties of the Infinities and NaNs in the IEEE standard 754 for Binary Floating-Point
Arithmetic will be simulated in UNIX on the DEC VAX by using its Reserved Operands. Meanwhile, the Invalid, Overflow and Divide-by-Zero
exceptions of the IEEE standard are being approximated on a VAX by calls to a procedure infnan in appropriate places in libm. When better
exception-handling is implemented in UNIX, only infnan among the codes in libm will have to be changed. And users of libm can design their
own infnan now to insulate themselves from future changes.
Whenever an elementary function code in libm has to simulate one of the aforementioned IEEE exceptions, it calls infnan(iarg) with an
appropriate value of iarg. Then a reserved operand fault stops computation. But infnan could be replaced by a function with the same name
that returns some plausible value, assigns an apt value to the global variable errno, and allows computation to resume. Alternatively, the
Reserved Operand Fault Handler could be changed to respond by returning that plausible value, etc. instead of aborting.
In the table below, the first two columns show various exceptions signaled by the IEEE standard, and the default result it prescribes. The
third column shows what value is given to iarg by functions in libm when they invoke infnan(iarg) under analogous circumstances on a VAX.
Currently infnan stops computation under all those circumstances. The last two columns offer an alternative; they suggest a setting for
errno and a value for a revised infnan to return. And a C program to implement that suggestion follows.
IEEE IEEE
Signal Default iarg errno infnan
__________________________________________________
Invalid NaN EDOM EDOM 0
Overflow +-Infinity ERANGE ERANGEHUGE
Div-by-0 +-Infinity +-ERANGE ERANGE or EDOM+-HUGE
(HUGE = 1.7e38 ... nearly 2.0**127)
ALTERNATIVE infnan:
#include <math.h>
#include <errno.h>
extern int errno ;
double infnan(iarg)
int iarg ;
{
switch(iarg) {
case ERANGE: errno = ERANGE; return(HUGE);
case -ERANGE: errno = EDOM; return(-HUGE);
default: errno = EDOM; return(0);
}
}
SEE ALSO math(3M), intro(2), signal(3).
ERANGE and EDOM are defined in <errno.h>. See intro(2) for explanation of EDOM and ERANGE.
4.3 Berkeley Distribution May 27, 1986 INFNAN(3M)