Sponsored Content
Full Discussion: awk printf problem
Top Forums UNIX for Advanced & Expert Users awk printf problem Post 43261 by krishna on Friday 14th of November 2003 01:56:53 AM
Old 11-14-2003
I've checked the setting is
#define DBL_MAX 1.79769313486231570e+308

what I want to ask is how many total digits can hadled by awk?
 

10 More Discussions You Might Find Interesting

1. Programming

disturbing problem with PRINTF() !!

hello everybody, here is my problem: ________________________________________ #include <stdio.h> int main() { int i=10; printf("value is %i",i); return 0; } _________________________________________ when i compile and execute, nothing appears on screen!! but if i replace the printf... (2 Replies)
Discussion started by: brain_processin
2 Replies

2. Shell Programming and Scripting

perl: printf indentation problem

hi all, im having a problem with using perl printf. my requirement is to print a string (like ) at the right most end of the screen. i tried this perl script, but it fails with an error; #!/usr/bin/perl use strict; use warnings; my $scrW = 0; my $str = `stty size`; # get the... (5 Replies)
Discussion started by: wolwy_pete
5 Replies

3. Shell Programming and Scripting

printf problem

I have the following code: $ awk '{ printf "%-10s %s\n", $1, $2, $3, $4, $5, $5, $6 }' file i can only print the first 2 elements ($1,$2). How can i print all the elements to appear like this: aardvark 5555553 jhfjhfjkg efiigig ejkfjkej wjkdjk alpo-net 5553412 ... (2 Replies)
Discussion started by: DDoS
2 Replies

4. Shell Programming and Scripting

Awk printf problem

Hi, I've got a basic problem using printf statement in awk. I want to write float values with always 8 characters width. Examples : 1.345678 12.45678 123.4567 1234.678 -23.5678 -2.45678 -23456.8 ..... I cannot find the right printf format %8.1f, %7.5f.... Can anyone help ?... (4 Replies)
Discussion started by: cazhot
4 Replies

5. Shell Programming and Scripting

awk and printf

echo $bbsize 1.5 echo $fillpercent .95 echo $bbsize | awk '{printf "%.2f\n",$0*$fillpercent}' 2.25 echo $bbsize | awk '{printf "%.2f\n",$0*.95}' 1.42 1.42 is what I'm expecting... echo $blocksize 4096 echo $bbsize | awk '{printf "%.2f\n",$0*$blocksize}' 2.25 echo $bbsize |... (3 Replies)
Discussion started by: xgringo
3 Replies

6. Shell Programming and Scripting

IF and awk/printf

Hi Friends, Scripting newb here. So I'm trying to create a geektool script that uses awk and printf to output certain fields from top (namely command, cpu%, rsize, pid and time, in that order). After much trial and error, I've pretty much succeeded, with one exception. Any process whose name... (3 Replies)
Discussion started by: thom.mattson
3 Replies

7. Shell Programming and Scripting

Printf problem

I am having a major problem with printf, The more I pad it, the less I see :( The problem is in the first function, report Am I ruining output somewhere? I wont print out the names propely, it cuts them off or deletes them completely :( #!/bin/bash report() { printf "%-10s" STUD# ... (2 Replies)
Discussion started by: L0ckz0r
2 Replies

8. Shell Programming and Scripting

printf problem

In one of the scripts I am using pintf function as following printf "%s%s%s\n" "$f1" "$f2" "$f3" f3 variable contains a string of 10 characters. However it has value first 7 character and last 3 characters are empty. Example Aaaaaaa<3 spaces> bbbbbbb<3 spaces> ccccccc<3 spaces>... (4 Replies)
Discussion started by: varunrbs
4 Replies

9. Shell Programming and Scripting

awk with printf

Hi, I am using the following code to assign a count value to a variable. But I get nothing. Do you see anything wrong here. I am new to all this. $CTR=`remsh $m -l $MACHINES{$m} -n cat $output | grep -v sent | grep \"$input\" | sort -u | awk '{print $5}'`; Upto sort - u it's... (2 Replies)
Discussion started by: nurani
2 Replies

10. Shell Programming and Scripting

problem with printf in shell script

i have written small script as follows: name="hi hello" printf "%-20s" $name This gives me strange output. -20s format is applied on both word of string. i.e it displays both word hi and hello in space of 20 length. I want to display entire string "hi hello" in length of 20 space. plz... (2 Replies)
Discussion started by: admc123
2 Replies
tclrep/machineparameters(n)					      tclrep					       tclrep/machineparameters(n)

__________________________________________________________________________________________________________________________________________________

NAME
tclrep/machineparameters - Compute double precision machine parameters. SYNOPSIS
package require snit machineparameters create objectname ?options...? objectname configure ?options...? objectname cget opt objectname destroy objectname compute objectname get key objectname tostring objectname print _________________________________________________________________ DESCRIPTION
The math::machineparameters package is the Tcl equivalent of the DLAMCH LAPACK function. In floating point systems, a floating point num- ber is represented by x = +/- d1 d2 ... dt basis^e where digits satisfy 0 <= di <= basis - 1, i = 1, t with the convention : o t is the size of the mantissa o basis is the basis (the "radix") The compute method computes all machine parameters. Then, the get method can be used to get each parameter. The print method prints a report on standard output. EXAMPLE
In the following example, one compute the parameters of a desktop under Linux with the following Tcl 8.4.19 properties : % parray tcl_platform tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = i686 tcl_platform(os) = Linux tcl_platform(osVersion) = 2.6.24-19-generic tcl_platform(platform) = unix tcl_platform(tip,268) = 1 tcl_platform(tip,280) = 1 tcl_platform(user) = <username> tcl_platform(wordSize) = 4 The following example creates a machineparameters object, computes the properties and displays it. set pp [machineparameters create %AUTO%] $pp compute $pp print $pp destroy This prints out : Machine parameters Epsilon : 1.11022302463e-16 Beta : 2 Rounding : proper Mantissa : 53 Maximum exponent : 1024 Minimum exponent : -1021 Overflow threshold : 8.98846567431e+307 Underflow threshold : 2.22507385851e-308 That compares well with the results produced by Lapack 3.1.1 : Epsilon = 1.11022302462515654E-016 Safe minimum = 2.22507385850720138E-308 Base = 2.0000000000000000 Precision = 2.22044604925031308E-016 Number of digits in mantissa = 53.000000000000000 Rounding mode = 1.00000000000000000 Minimum exponent = -1021.0000000000000 Underflow threshold = 2.22507385850720138E-308 Largest exponent = 1024.0000000000000 Overflow threshold = 1.79769313486231571E+308 Reciprocal of safe minimum = 4.49423283715578977E+307 The following example creates a machineparameters object, computes the properties and gets the epsilon for the machine. set pp [machineparameters create %AUTO%] $pp compute set eps [$pp get -epsilon] $pp destroy REFERENCES
o "Algorithms to Reveal Properties of Floating-Point Arithmetic", Michael A. Malcolm, Stanford University, Communications of the ACM, Volume 15 , Issue 11 (November 1972), Pages: 949 - 951 o "More on Algorithms that Reveal Properties of Floating, Point Arithmetic Units", W. Morven Gentleman, University of Waterloo, Scott B. Marovich, Purdue University, Communications of the ACM, Volume 17 , Issue 5 (May 1974), Pages: 276 - 277 CLASS API
machineparameters create objectname ?options...? The command creates a new machineparameters object and returns the fully qualified name of the object command as its result. -verbose verbose Set this option to 1 to enable verbose logging. This option is mainly for debug purposes. The default value of verbose is 0. OBJECT API
objectname configure ?options...? The command configure the options of the object objectname. The options are the same as the static method create. objectname cget opt Returns the value of the option which name is opt. The options are the same as the method create and configure. objectname destroy Destroys the object objectname. objectname compute Computes the machine parameters. objectname get key Returns the value corresponding with given key. The following is the list of available keys. o -epsilon : smallest value so that 1+epsilon>1 is false o -rounding : The rounding mode used on the machine. The rounding occurs when more than t digits would be required to repre- sent the number. Two modes can be determined with the current system : "chop" means than only t digits are kept, no matter the value of the number "proper" means that another rounding mode is used, be it "round to nearest", "round up", "round down". o -basis : the basis of the floating-point representation. The basis is usually 2, i.e. binary representation (for example IEEE 754 machines), but some machines (like HP calculators for example) uses 10, or 16, etc... o -mantissa : the number of bits in the mantissa o -exponentmax : the largest positive exponent before overflow occurs o -exponentmin : the largest negative exponent before (gradual) underflow occurs o -vmax : largest positive value before overflow occurs o -vmin : largest negative value before (gradual) underflow occurs objectname tostring Return a report for machine parameters. objectname print Print machine parameters on standard output. COPYRIGHT
Copyright (c) 2008 Michael Baudin <michael.baudin@sourceforge.net> math 1.0 tclrep/machineparameters(n)
All times are GMT -4. The time now is 10:09 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy