Sponsored Content
Top Forums Shell Programming and Scripting Adding "1.123+4.242 = 5" problem Post 302577712 by jim mcnamara on Tuesday 29th of November 2011 06:19:11 PM
Old 11-29-2011
awk, by default, uses double precision (floating decimal) arithmetic.

Use:
Code:
 printf("%.3f %.3f %.3f\n", x1, y0, z0)

instead of your print x1, y0, z0 print statement
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Unix "at" / "Cron" Command New Problem...Need help

Hi All, I am trying to schedule a one time job using the at command with the help of shell script for my project. The shell script should take a parameter as a command line argument from the at command itself. Is it possible to take a command line parameter for a shell script in the command... (3 Replies)
Discussion started by: Mohanraj
3 Replies

2. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

3. UNIX and Linux Applications

A question/problem about oracle "tns listener" and "enterprise manager"

hi, I have * an IBM P550 machine, * an AIX 5.3 running on it and * an oracle database, already installed on it. The problem (or question of my own) is: Oracle tns listener, "CT_LISTENER", and the enterprise manager (EM) of the instance, which is uniq instance and called... (0 Replies)
Discussion started by: talipk
0 Replies

4. UNIX for Advanced & Expert Users

A question/problem about oracle "tns listener" and "enterprise manager"

hi, I have a problem about the Oracle related components. I'm not able to find any answer yet, and waiting for your responses... Here is the configuration of my system: * an IBM P550 machine, * an AIX 5.3 running on it and * an oracle database, already installed on it. The problem (or... (1 Reply)
Discussion started by: talipk
1 Replies

5. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

6. Shell Programming and Scripting

Problem with "find" and "grep" command

I want to list all files/lines which except those which contain the pattern ' /proc/' OR ' /sys/' (mind the leading blank). In a first approach I coded: find / -exec ls -ld {} | grep -v ' /proc/| /sys/' \; > /tmp/list.txt But this doesn't work. I got an error (under Ubuntu): grep:... (5 Replies)
Discussion started by: pstein
5 Replies

7. Post Here to Contact Site Administrators and Moderators

Suggestion: adding two new groups "sed" and "awk"

Majority of the questions are pertaining file/string parsing w.r.t sed or awk It would be nice to have these two as their own sub category under shell-programming-scripting which can avoid lot of duplicate posts. (1 Reply)
Discussion started by: jville
1 Replies

8. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

9. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies
float.h(3HEAD)							      Headers							    float.h(3HEAD)

NAME
float.h, float - floating types SYNOPSIS
#include <float.h> DESCRIPTION
The characteristics of floating types are defined in terms of a model that describes a representation of floating-point numbers and values that provide information about an implementation's floating-point arithmetic. The following parameters are used to define the model for each floating-point type: s sign (+-1) b base or radix of exponent representation (an integer >1) e exponent (an integer between a minimum emin and a maximum emax) p precision (the number of base-b digits in the significand) fk non-negative integers less than b (the significand digits) In addition to normalized floating-point numbers (f1>0 if x!=0), floating types might be able to contain other kinds of floating-point num- bers, such as subnormal floating-point numbers (x!=0, e=emin, f1=0) and unnormalized floating-point numbers (x!=0, e=emin, f1=0), and val- ues that are not floating-point numbers, such as infinities and NaNs. A NaN is an encoding signifying Not-a-Number. A quiet NaN propagates through almost every arithmetic operation without raising a floating-point exception; a signaling NaN generally raises a floating-point exception when occurring as an arithmetic operand. The accuracy of the library functions in math.h(3HEAD) and complex.h(3HEAD) that return floating-point results is defined on the libm(3LIB) manual page. All integer values in the <float.h> header, except FLT_ROUNDS, are constant expressions suitable for use in #if preprocessing directives; all floating values are constant expressions. All except DECIMAL_DIG, FLT_EVAL_METHOD, FLT_RADIX, and FLT_ROUNDS have separate names for all three floating-point types. The floating-point model representation is provided for all values except FLT_EVAL_METHOD and FLT_ROUNDS. The rounding mode for floating-point addition is characterized by the value of FLT_ROUNDS: -1 Indeterminable. 0 Toward zero. 1 To nearest. 2 Toward positive infinity. 3 Toward negative infinity. The values of operations with floating operands and values subject to the usual arithmetic conversions and of floating constants are evalu- ated to a format whose range and precision might be greater than required by the type. The use of evaluation formats is characterized by the architecture-dependent value of FLT_EVAL_METHOD: -1 Indeterminable. 0 Evaluate all operations and constants just to the range and precision of the type. 1 Evaluate operations and constants of type float and double to the range and precision of the double type; evaluate long double operations and constants to the range and precision of the long double type. 2 Evaluate all operations and constants to the range and precision of the long double type. The values given in the following list are defined as constants. o Radix of exponent representation, b. FLT_RADIX o Number of base-FLT_RADIX digits in the floating-point significand, p. FLT_MANT_DIG DBL_MANT_DIG LDBL_MANT_DIG o Number of decimal digits, n, such that any floating-point number in the widest supported floating type with pmax radix b digits can be rounded to a floating-point number with n decimal digits and back again without change to the value. DECIMAL_DIG o Number of decimal digits, q, such that any floating-point number with q decimal digits can be rounded into a floating-point number with p radix b digits and back again without change to the q decimal digits. FLT_DIG DBL_DIG LDBL_DIG o Minimum negative integer such that FLT_RADIX raised to that power minus 1 is a normalized floating-point number, emin. FLT_MIN_EXP DBL_MIN_EXP LDBL_MIN_EXP o Minimum negative integer such that 10 raised to that power is in the range of normalized floating-point numbers. FLT_MIN_10_EXP DBL_MIN_10_EXP LDBL_MIN_10_EXP o Maximum integer such that FLT_RADIX raised to that power minus 1 is a representable finite floating-point number, emax. FLT_MAX_EXP DBL_MAX_EXP LDBL_MAX_EXP o Maximum integer such that 10 raised to that power is in the range of representable finite floating-point numbers. FLT_MAX_10_EXP DBL_MAX_10_EXP LDBL_MAX_10_EXP The values given in the following list are defined as constant expressions with values that are greater than or equal to those shown: o Maximum representable finite floating-point number. FLT_MAX DBL_MAX LDBL_MAX The values given in the following list are defined as constant expressions with implementation-defined (positive) values that are less than or equal to those shown: o The difference between 1 and the least value greater than 1 that is representable in the given floating-point type, b**1 - p. FLT_EPSILON DBL_EPSILON LDBL_EPSILON o Minimum normalized positive floating-point number, b**emin**-. FLT_MIN DBL_MIN LDBL_MIN ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ SEE ALSO
complex.h(3HEAD), math.h(3HEAD), attributes(5), standards(5) SunOS 5.10 17 Dec 2003 float.h(3HEAD)
All times are GMT -4. The time now is 04:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy