Sponsored Content
Top Forums Shell Programming and Scripting Adding Long List Of Large Numbers Post 302834023 by RudiC on Thursday 18th of July 2013 08:59:00 AM
Old 07-18-2013
... whatever is the "proper format"...
For a non-scientific notation use printf and the %f conversion specifier, or set the OFMT variable accordingly.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to parse large numbers of shell scripts

I am trying to parse hundreds of shell scripts to determine how they related to each other. Ideally for every script, I would get an output of: What other scripts it calls What files it reads Environment variables it accesses Any ideas on how to do this? TIA! (2 Replies)
Discussion started by: bliss
2 Replies

2. UNIX for Dummies Questions & Answers

adding long user name

hello everybody: I need to add a 10 character user name to my tru64 system, is there any work around I can use for that. thanks alot (1 Reply)
Discussion started by: aladdin
1 Replies

3. UNIX for Dummies Questions & Answers

Grep alternative to handle large numbers of files

I am looking for a file with 'MCR0000000716214' in it. I tried the following command: grep MCR0000000716214 * The problem is that the folder I am searching in has over 87000 files and I am getting the following: bash: /bin/grep: Arg list too long Is there any command I can use that can... (6 Replies)
Discussion started by: runnerpaul
6 Replies

4. Shell Programming and Scripting

adding a list of numbers 3 by 3

i have a list of numbers like this; 124 235 764 782 765 451 983 909 ... and i want to make a sum with the first 3 of them then the next 3 and so on. 124+235+764=1123 782+765+451=1998 ... some ideas? (4 Replies)
Discussion started by: Tártaro
4 Replies

5. Programming

Working with extremely large numbers in C

Hi All, I am just curious, not programming anything of my own. I know there are libraries like gmp which does all such things. But I really need to know HOW they do all such things i.e. working with extremely large unimaginable numbers which are beyond the integer limit. They can do add,... (1 Reply)
Discussion started by: shoaibjameel123
1 Replies

6. UNIX for Dummies Questions & Answers

Hope to create a file with two large column, with several numbers

I hope to create a file made up of 2 columns - first column print out number 0~61000 every 50 of it - second column just contains 0 delineated by space such as 0 0 50 0 100 0 150 0 200 0 ... 60900 0 60950 0 61000 0 Which command should I need to use? I think I might need to use... (5 Replies)
Discussion started by: exsonic
5 Replies

7. UNIX for Dummies Questions & Answers

Find common numbers from two very large files using awk or the like

I've got two files that each contain a 16-digit number in positions 1-16. The first file has 63,120 entries all sorted numerically. The second file has 142,479 entries, also sorted numerically. I want to read through each file and output the entries that appear in both. So far I've had no... (13 Replies)
Discussion started by: Scottie1954
13 Replies

8. Shell Programming and Scripting

Adding (as in arithmetic) to numbers in columns in file, and writing new file with new numbers

Hi again. Sorry for all the questions — I've tried to do all this myself but I'm just not good enough yet, and the help I've received so far from bartus11 has been absolutely invaluable. Hopefully this will be the last bit of file manipulation I need to do. I have a file which is formatted as... (4 Replies)
Discussion started by: crunchgargoyle
4 Replies

9. Shell Programming and Scripting

Adding lines to a large file

Hello, I have a relatively large text file (25,000K) consisting of records of data. For each record, I need to create a new line based on what is already there. Every record has a block that looks like, M END > <ID> 1 > <SOURCE> KEGG > <SOURCE_ID> C00002 > <NAME> ATP;... (4 Replies)
Discussion started by: LMHmedchem
4 Replies

10. Shell Programming and Scripting

Parse for 2 numbers in large single line

Hi All, I am writing a script in which I need to gather 2 numbers for 'total' and 'successful'. The goal is to compare the two numbers and if they are not equal, rerun the task until all are successful. I'm thinking the best way will be with awk or sed, but I really don't know where to begin... (8 Replies)
Discussion started by: hburnswell
8 Replies
STRFROMD(3)						     Linux Programmer's Manual						       STRFROMD(3)

NAME
strfromd, strfromf, strfroml - convert a floating-point value into a string SYNOPSIS
#include <stdlib.h> int strfromd(char *restrict str, size_t n, const char *restrict format, double fp); int strfromf(char *restrict str, size_t n, const char *restrict format, float fp); int strfroml(char *restrict str, size_t n, const char *restrict format, long double fp); Feature Test Macro Requirements for glibc (see feature_test_macros(7)): strfromd(), strfromf(), strfroml(): __STDC_WANT_IEC_60559_BFP_EXT__ DESCRIPTION
These functions convert a floating-point value, fp, into a string of characters, str, with a configurable format string. At most n charac- ters are stored into str. The terminating null character ('') is written if and only if n is sufficiently large, otherwise the written string is truncated at n characters. The strfromd(), strfromf(), and strfroml() functions are equivalent to snprintf(str, n, format, fp); except for the format string. Format of the format string The format string must start with the character '%'. This is followed by an optional precision which starts with the period character (.), followed by an optional decimal integer. If no integer is specified after the period character, a precision of zero is used. Finally, the format string should have one of the conversion specifiers a, A, e, E, f, F, g, or G. The conversion specifier is applied based on the floating-point type indicated by the function suffix. Therefore, unlike snprintf(), the format string does not have a length modifier character. See snprintf(3) for a detailed description of these conversion specifiers. The implementation conforms to the C99 standard on conversion of NaN and infinity values: If fp is a NaN, +NaN, or -NaN, and f (or a, e, g) is the conversion specifier, the conversion is to "nan", "nan", or "-nan", respec- tively. If F (or A, E, G) is the conversion specifier, the conversion is to "NAN" or "-NAN". Likewise if fp is infinity, it is converted to [-]inf or [-]INF. A malformed format string results in undefined behavior. RETURN VALUE
The strfromd(), strfromf(), and strfroml() functions return the number of characters that would have been written in str if n had enough space, not counting the terminating null character. Thus, a return value of n or greater means that the output was truncated. VERSIONS
The strfromd(), strfromf(), and strfroml() functions are available in glibc since version 2.25. ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7) and the POSIX Safety Concepts section in GNU C Library manual. +------------+----------------------------------+----------------+ |Interface | Attribute | Value | +------------+----------------------------------+----------------+ | | Thread safety | MT-Safe locale | |strfromd(), +----------------------------------+----------------+ |strfromf(), | Asynchronous signal safety | AS-Unsafe heap | |strfroml() +----------------------------------+----------------+ | | Asynchronous cancellation safety | AC-Unsafe mem | +------------+----------------------------------+----------------+ Note: these attributes are preliminary. CONFORMING TO
C99, ISO/IEC TS 18661-1. NOTES
The strfromd(), strfromf(), and strfroml() functions take account of the LC_NUMERIC category of the current locale. EXAMPLES
To convert the value 12.1 as a float type to a string using decimal notation, resulting in "12.100000": #define __STDC_WANT_IEC_60559_BFP_EXT__ #include <stdlib.h> int ssize = 10; char s[ssize]; strfromf(s, ssize, "%f", 12.1); To convert the value 12.3456 as a float type to a string using decimal notation with two digits of precision, resulting in "12.35": #define __STDC_WANT_IEC_60559_BFP_EXT__ #include <stdlib.h> int ssize = 10; char s[ssize]; strfromf(s, ssize, "%.2f", 12.3456); To convert the value 12.345e19 as a double type to a string using scientific notation with zero digits of precision, resulting in "1E+20": #define __STDC_WANT_IEC_60559_BFP_EXT__ #include <stdlib.h> int ssize = 10; char s[ssize]; strfromd(s, ssize, "%.E", 12.345e19); SEE ALSO
atof(3), snprintf(3), strtod(3) COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/. GNU
2017-09-15 STRFROMD(3)
All times are GMT -4. The time now is 09:49 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy