Sponsored Content
Full Discussion: max precision in float
Top Forums Programming max precision in float Post 302144350 by jim mcnamara on Wednesday 7th of November 2007 04:00:49 PM
Old 11-07-2007
Or look in limits.h yourself for FLT_DIG and DBL_DIG

On POSIX-compliant UNIX boxes POSIX requires those to be at least

FLT_DIG 6
DBL_DIG 15
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

precision getting?

I need to find out the precision on a solaris machine using the unix terminal. How do I find this out? Specifics needed: How are single precision numbers represented (8 or 16 bit) How are double precision numbers represented (16 or 32 bit) How are they stored. ( some computers store numbers... (1 Reply)
Discussion started by: Townsfolk
1 Replies

2. UNIX for Dummies Questions & Answers

bc arbitrary precision cal lang

Hello all, I don't know ksh that well but when I try to run a simple script using the bc command I get "unexpected '.' ", has any one encouter this or help me. I'm running under redaht 7.2. Here is a simple example: #!/bin/ksh # kilo=`echo "2495 * .25"|bc` if then echo "LESS THEN"... (2 Replies)
Discussion started by: larry
2 Replies

3. Programming

math.h: float ceilf(float x)

Good morning, I'm testing the use of ceilf: /*Filename: str.c*/ #include <stdio.h> #include <math.h> int main (void) { float ceilf(float x); int dev=3, result=0; float tmp = 3.444f; printf("Result: %f\n",ceilf(tmp)); return 0; } (1 Reply)
Discussion started by: jonas.gabriel
1 Replies

4. Shell Programming and Scripting

unix diff with numerical precision

Hi, I search a unix utility to diff two files, that takes as argument numerical precision as well. If two files are different only in numbers and the difference is less than precision then the result as they are the same. The precision may be absolute (x1-x2) or relative (x2/x1). Also I need the... (1 Reply)
Discussion started by: stella
1 Replies

5. Shell Programming and Scripting

Count the decimal numbers with 6 precision

Hi guys, I have a single column file with millions of records. I want to count the number of records with 6 decimal precision. for ex: 1234.12 1234.132 12345.12345 1234.1 1234.13 1234.123456 243435.454555 i need to count the number of records with precision of 6 ( i.e here the... (4 Replies)
Discussion started by: marcus_kosaman
4 Replies

6. Shell Programming and Scripting

Double-precision result (awk)

hi, I am a new awk user, now i want to change my result from 1 ca 0.2057422D-01 -0.7179106D-02 -0.5600872D-02 2 o 0.2463722D-01 -0.1554542D-01 0.3110649D-01 3 h -0.1068047D-01 0.1016889D-01 -0.4088230D-02 to 1 ca 0.02057422 -0.007179106 -0.005600872 2 o 0.02463722 -0.01554542 ... (4 Replies)
Discussion started by: wanchem
4 Replies

7. Shell Programming and Scripting

change precision of bash variable

I have a variable in a bash script, DISTANCE=`awk 'BEGIN {FS="\t"} {if (NR==2) print $3;}' $OUTFILE` this is a real number taken from a file. The value are like, 0.334561754018 I am using this value in a file name, '$NAME'_'$DISTANCE'.txt I would like to shorten the number some to... (4 Replies)
Discussion started by: LMHmedchem
4 Replies

8. Shell Programming and Scripting

Get timestamp with millisecond precision

Hi All, could any body let me know. how to get timestamp with millisecond precision in unix bash shell. example -->2005-12-06- 4-22-35-195 please help me. Thanks, Krupa:wall: (3 Replies)
Discussion started by: krupasindhu18
3 Replies

9. Shell Programming and Scripting

Precision in print

I have a shell script which prints a variable to a text file (sorry if this is the wrong terminology, I'm new to this): awk `{sumdiffsqt+=$1;stdevt=sqrt(sumdiffsqt/('${n}'-1));errt=stdevt/sqrt('${n}')} END {print '$period',stdevt,errt}' diffsqt.txt >> ${xstation1}_${xstation2}_tt.err I need... (4 Replies)
Discussion started by: claire.a
4 Replies
LIMITS(3)						   BSD Library Functions Manual 						 LIMITS(3)

NAME
limits -- standard limits SYNOPSIS
#include <limits.h> DESCRIPTION
The <limits.h> header defines various compile-time and runtime limits. These can be grouped into three categories: 1. Compile-time limits defined in a header file. 2. Runtime system limits that are not associated with a file or directory; see sysconf(3). 3. Runtime limits that are associated with a file or directory; see pathconf(2). The <limits.h> header has been standardized by at least three entities. ISO Limits The limits defined by the ISO/IEC 9899:1999 (``ISO C99'') standard are all compile-time limits. The numerical (integer) limits are: Constant Type Minimum value CHAR_BIT char 8 SCHAR_MAX signed char 127 SCHAR_MIN signed char -127 UCHAR_MAX unsigned char 255 INT_MAX int 32767 INT_MIN int -32767 UINT_MAX unsigned int 65535 SHRT_MIN short -32767 SHRT_MAX short 32767 USHRT_MAX unsigned short 65535 LONG_MAX long int 2147483647 LONG_MIN long int -2147483647 ULONG_MAX unsigned long int 4294967295 LLONG_MAX long long int 9223372036854775807 LLONG_MIN long long int -9223372036854775807 ULLONG_MAX unsigned long long int 18446744073709551615 MB_LEN_MAX - 1 All listed limits may vary across machines and operating systems. The standard guarantees only that the implementation-defined values are equal or greater in absolute value to those shown. The values permit a system with 16-bit integers using one's complement arithmetic. Depending whether the system defines char as signed or unsigned, the maximum and minimum values are: Constant Type Minimum value CHAR_MAX char either SCHAR_MAX or UCHAR_MAX CHAR_MIN char either SCHAR_MIN or 0 The two special cases, CHAR_BIT and MB_LEN_MAX, define the number of bits in char and the maximum number of bytes in a multibyte character constant, respectively. POSIX Limits The POSIX.1 standard specifies numerous limits related to the operating system. For each limit, a separate constant prefixed with ``_POSIX_'' defines the lowest value that the limit is allowed to have on any POSIX compliant system. For instance, _POSIX_OPEN_MAX defines the minimum upper bound permitted by POSIX for the number of files that a single process may have open at any time. This ensures that a por- table program can safely reach these limits without prior knowledge about the actual limits used in a particular system. As the limits are not necessary invariant, pathconf(2) and sysconf(3) should be used to determine the actual value of a limit at runtime. The manual pages of these two functions also contain a more detailed description of the limits available in NetBSD. XSI Limits Also the X/Open System Interface Extension (XSI) specifies few limits. In NetBSD these are limited to LONG_BIT (the number of bits in long), WORD_BIT (the number of bits in a ``word''), and few limits related to float and double. SEE ALSO
getconf(1), pathconf(2), sysconf(3), types(3), unistd(3) Richard W. Stevens and Stephen A. Rago, Advanced Programming in the UNIX Environment, Addison-Wesley, Second Edition, 2005. BSD
August 9, 2011 BSD
All times are GMT -4. The time now is 05:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy