08-21-2015
Fellas, fellas, settle down... ;oD
I seem to have created a riot on this thread; now let me mediate.
Firstly I did quote using "INTEGER arithmetic".
Secondly I also quoted "it is a little tongue-in-cheek".
And thirdly it uses builtins only...
At Don...
Don, in his defence, used builtins although not INTEGER arithmetic; he admitted that ksh93 was used as he expended on my original upload using ksh's floating point - root=$((int(number ** .5))) ; I am assuming 'int' is part of ksh's arithmetic...
So Don, as bash cannot do floating point then you did cheat... ;oD
At neutronscott...
Well what can I say... ;oD
Using various [?]awk commands are not builtins so you also cheated... ;oD
At sea...
It would have been interesting to see your result too...
One very serious question however:-
How accurate is either "[?]awk's" or "ksh's" floating point?
Would there be a situation where there would be a false result due to a floating point __error__?
Bazza...
8 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All,
I have a file of the following format.
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="tomcat"/>
<role rolename="role1"/>
<role rolename="manager"/>
<role rolename="admin"/>
<user username="tomcat" password="tomcat" roles="tomcat"/>
<user... (5 Replies)
Discussion started by: nua7
5 Replies
2. UNIX for Dummies Questions & Answers
Here's my work of testing whether a number input is perfect or not..
echo Enter a number
read no
i=1
ans=0
while
do
if
then
ans='expr $ans + $i'
fi
i='expr $i + 1'
done
if
then
echo $no is perfect
else
echo $no is NOT perfect
fi (12 Replies)
Discussion started by: Cyansnow
12 Replies
3. AIX
I've got an aix-box somewhere on the network and a PC on my desk. Nothing fancy so far.
The PC is made dual-boot:
- windowsXP with putty & winSCP
or
- slackware 13 with xfce4 installed.
The aix-box runs DB2 v8.2 and I've installed db2top to monitor the database.
db2top is a character... (0 Replies)
Discussion started by: dr_te_z
0 Replies
4. Shell Programming and Scripting
Hi All,
I have a text file which looks like this:
computer programming
systems engineering
I want to get rid of these square brackets and also the text that is inside these brackets. So that my final text file looks like this:
computer programming
systems engineering
I am using... (3 Replies)
Discussion started by: shoaibjameel123
3 Replies
5. Shell Programming and Scripting
hi,
how to I do this?
i="4.000"
if ; then
echo "smaller"
fi
how do I convert the "4.000" to 4?
Thanks! (4 Replies)
Discussion started by: h0ujun
4 Replies
6. UNIX for Dummies Questions & Answers
I want to print only the lines that meet the criteria : "worde:" and "wordo;"
I got this far:
sed -n '/\(*\)\1e:\1o;/p;'
But it doesn't quite work.
Can someone please perfect it and tell me exactly how its a fixed version/what was wrong with mine?
Thanks heaps, (1 Reply)
Discussion started by: maximus73
1 Replies
7. Shell Programming and Scripting
Hi
Input File A
L006 AL01 0 (OCK)
L006 A006 0 (OCK)
L011 AR11 1 (NLOCK)
Input File B
L006 AL01 0 (OCK)
L006 A006 0 (OCK)
Need Egrep Command for perfect Match
Thanks (4 Replies)
Discussion started by: asavaliya
4 Replies
8. Shell Programming and Scripting
I have to find last delimiter in each line of a file and store the value after the last '/' in a variable in ksh script...Pls Pls help me:(The file is as shown below:
/opt/apps/cobqa/apps/abadv/bind/advc0007.bnd
/opt/apps/cobqa/apps/abbrio/bind/naac6115.bnd... (5 Replies)
Discussion started by: bhavanabahety
5 Replies
TRAPOV(3F) TRAPOV(3F)
NAME
trapov - trap and repair floating point overflow
SYNOPSIS
subroutine trapov (numesg, rtnval)
double precision rtnval
DESCRIPTION
NOTE: This routine applies only to the older VAX 11/780's. VAX computers made or upgraded since spring 1983 handle errors differently.
See trpfpe(3F) for the newer error handler. This routine has always been ineffective on the VAX 11/750. It is a null routine on the
PDP11.
This call sets up signal handlers to trap arithmetic exceptions and the use of illegal operands. Trapping arithmetic exceptions allows the
user's program to proceed from instances of floating point overflow or divide by zero. The result of such operations will be an illegal
floating point value. The subsequent use of the illegal operand will be trapped and the operand replaced by the specified value.
The first numesg occurrences of a floating point arithmetic error will cause a message to be written to the standard error file. If the
resulting value is used, the value given for rtnval will replace the illegal operand generated by the arithmetic error. Rtnval must be a
double precision value. For example, ``0d0'' or ``dflmax()''.
FILES
/usr/lib/libF77.a
SEE ALSO
trpfpe(3F), signal(3F), range(3F)
BUGS
Other arithmetic exceptions can be trapped but not repaired.
There is no way to distinguish between an integer value of 32768 and the illegal floating point form. Therefore such an integer value may
get replaced while repairing the use of an illegal operand.
4.2 Berkeley Distribution May 15, 1985 TRAPOV(3F)