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
logb(3M) logb(3M)
NAME
logb(), logbf(), logbl(), logbw(), logbq() - radix-independent exponent functions
SYNOPSIS
HP Integrity Server Only
DESCRIPTION
The function computes the exponent of the floating point value x. Formally, the return value is the integral part of log base r of |x| as
a signed floating point value, for nonzero x, where r is the radix of the machine's floating-point arithmetic. The radix r is 2 on HP-UX
systems.
If x is denormal, it is treated as though it were normalized, before the exponent is determined.
Integrity Server Only
is a version of it takes a argument and returns a result.
is a version of it takes a argument and returns a result.
is an version of it takes an argument and returns an result.
is equivalent to on HP-UX systems.
USAGE
To use these functions, compile either with the default option or with the and options.
To use (for Integrity servers) or compile also with
Make sure your program includes Link in the math library by specifying on the compiler or linker command line. For more information, see
the at the following site:
RETURN VALUE
Upon successful completion, returns the exponent of x.
If x is NaN, returns NaN.
If x returns +INFINITY.
If x is zero, returns (equal to -INFINITY) and raises the divide-by-zero floating-point exception.
ERRORS
If x is zero, sets to [EDOM].
Integrity Server Only
HP-UX functions on Integrity servers do not set by default. For setting, compile with the option.
SEE ALSO
frexp(3M), ilogb(3M), scalb(3M), scalbn(3M), scalbln(3M), math(5).
STANDARDS CONFORMANCE
: SVID3, XPG4.2, ANSI C, ISO/IEC C99 (including Annex F, ``IEC 60559 floating-point arithmetic'')
: ISO/IEC C99 (including Annex F, ``IEC 60559 floating-point arithmetic'')
logb(3M)