Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Why does fibonacci sequence script stop making sense at 92nd iteration? Post 302416408 by jgt on Monday 26th of April 2010 10:55:50 AM
Old 04-26-2010
So if its just for fun, write your own double precision, you know the rules 5+6 = 1 carry 1.
Just do the split at 9 decimal digits. Print the result with no spaces between the two values.
 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Process calls - making sense of truss results

Can someone point me at resources for system calls? Specifically, I am trying to make sense of what I am seeing in a truss command. Thanks! (3 Replies)
Discussion started by: jpeery
3 Replies

2. Solaris

STOP A sequence

Hi, I have a sun sparc system. I don't have a sun keyboard, hence i connected a pc keyboard. I would like to know the "STOP A" equivalent command to be used on pc keyboard. Regards, Raja (4 Replies)
Discussion started by: RajaRC
4 Replies

3. Solaris

Making sense of df -k & format verify output

I'm posting the output from two disks on my Solaris machine. The first part is the output from using the format command and then using the verify option on each disk. The last part is the output from my df -k command. I'm trying to match the partition to the filesystem/mount point. I'm assuming... (13 Replies)
Discussion started by: gonzotonka
13 Replies

4. UNIX for Dummies Questions & Answers

Need help making a start/stop script...

i have two separate scripts that work nicely to curl and generate two files.. one html and one txt so a total of four. When the script starts up i want it to: call and run shellscripta call and run shellscriptb sleep for about 40 seconds again run shellscripta again run shellscriptb check... (4 Replies)
Discussion started by: phpfreak
4 Replies

5. Shell Programming and Scripting

Shell script to find the sum of first n Fibonacci numbers

pls give me the solution for this i need it for my exam pls pls pls Shell script to find the sum of first n Fibonacci numbers (1 Reply)
Discussion started by: Kshitija
1 Replies

6. Shell Programming and Scripting

howto stop loop iteration

I wonder how to stop further loop iterations when conditions gets false e.g. This file.txt contains the following structure : 1 2 3 4 5 6 7 8 9 10 How to stop iteration when if statement gets false ? for n in `cat file.txt` do if (( n<=5 )) (1 Reply)
Discussion started by: presul
1 Replies

7. Homework & Coursework Questions

program to find and print a Fibonacci sequence of numbers. --Errors

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: I am trying to convert a C language program over to Sparc Assembley and I am getting Undefined first referenced... (4 Replies)
Discussion started by: kenjiro310
4 Replies

8. Programming

This Makes NO sense. I'm making a game and getting an error, need help.

Okay so I'm making a simple text based game that branches into different scenarios. By branching I mean branching off into whole different files with that part of the game in it. I got tired of working on scenario 1 so I'm working on scenario 2. As I get started and try to test it, I get an error... (1 Reply)
Discussion started by: lemonoid
1 Replies

9. Solaris

Beadm create -p on another pool - making sense of it

Hi all, I am trying out Solaris 11.3 Realize the option of -p when using beadm that i can actually create another boot environment on another pool. root@Unicorn6:~# beadm create -p mypool solaris-1 root@Unicorn6:~# beadm list -a BE/Dataset/Snapshot Flags... (1 Reply)
Discussion started by: javanoob
1 Replies
printf(3s)																printf(3s)

Name
       printf, fprintf, sprintf - formatted output conversion

Syntax
       #include <stdio.h>

       int printf( format [, arg ] ...	)
       char *format;

       int fprintf( stream, format [, arg ] ...
       FILE *stream;
       char *format;

   BSD Environment
       char *sprintf( s, format [, arg ] ...  )
       char *s, *format;

   System V and POSIX Environments
       int sprintf( s, format [, arg ] ...  )
       char *s, format;

Description
       The  function  places output on the standard output stream, The subroutine places output on the named output stream.  The subroutine places
       output in the string s, and appends the null terminator `' to the end of the string.

       The first argument controls how each of these functions converts, formats, and prints the other arguments. The first argument is a  charac-
       ter  string  that  contains two types of objects, characters and conversion specifications.  These functions copy characters that appear in
       the first argument to the output stream.  Conversion specifications cause these functions to convert the next successive argument and  send
       the formatted argument to the output stream.

       You introduce conversion specifications using the percent sign (%).  Following the %, you can include:

       o    Zero or more flags, which modify the meaning of the conversion specification.

       o    An optional minus sign (-), which specifies left adjustment of the converted value in the indicated field.

       o    An	optional  digit  string  that specifies a field width.	If the converted value has fewer characters than the field width, pads the
	    value with blanks.	By default, pads the value on the left.  If the conversion string specifies the value is left-justified, pads  the
	    value on the right.  If the field width begins with a zero, pads the values with zeros, instead of blanks.

       o    An optional period (.), which separates the field width from the next digit string.

       o    An	optional  digit  string specifying a precision. The precision controls the number of digits that appear after the radix character,
	    exponential and floating-point conversions.  Precision also controls the maximum number of characters that are placed in the converted
	    value for a string.

       o    The  character h or l specifying that a following d, i, o, u, x, or X corresponds to an integer or longword integer argument.  You can
	    use an uppercase L or a lowercase l.

       o    A character that indicates the type of conversion to be applied.

       A field width or precision can be an asterisk (*), instead of a digit string.  If you use an asterisk, you can  include	an  argument  that
       supplies the field width or precision.

       The flag characters and their meanings are as follows:

       -    The result of the conversion is left-justified within the field.

       +    The result of a signed conversion always begins with a sign (+ or -).

       blank
	    If	the first character of a signed conversion is not a sign, pads the value on the left with a blank.  If the blank and plus sign (+)
	    flags both appear, ignores the blank flag.

       The  The value is to be converted to an alternative form.

	    For c, d, s, and u conversions, this flag has no effect.

	    For o
	     conversions, this flag increases the precision to force the first digit of the result to be a zero.

	    For x or X conversions, pads a non-zero result on the left with 0x or 0X.

	    For e, E, f, g, and G conversions, the result always contains a radix character, even if no digits follow that  character.	 (A  radix
	    character usually appears in the result of these conversions only if a digit follows it.)

	    For g and G conversions, does not remove trailing zeros from the result.

       The conversion characters and their meanings are as follows:

       dox  Convert the integer argument to decimal, octal, or hexadecimal notation, respectively.

       f    Convert the floating point or double precision argument to decimal notation in the style [- ]ddd.ddd, where the number of ds following
	    the radix character is equal to the precision for the argument.  If the precision is missing, prints six digits. If the  precision	is
	    explicitly zero, the function prints no digits and no radix characters.

       e    Convert  the floating point or double precision argument in the style [- ]d.  ddde+-dd, where one digit appears before the radix char-
	    acter and the number of digits that appear after the radix character is equal to the precision.  When you omit the	precision,  prints
	    six digits.

       g    Convert  the floating point or double precision argument to style d, style f, or style e.  The style uses depends on the format of the
	    converted value.  The function removes trailing zeros before evaluating the format of the converted value.

	    If a radix character appears in the converted value that is followed by a digit, uses style d.  If the  converted  value  contains	an
	    exponent that is is less than -4 or greater than the precision, the function uses style .BR e .  Otherwise, the function uses style f.

       c    Print the character argument.

       s    Print  the	character  argument.  The  function prints the argument until it encounters a null characters or has printed the number of
	    characters specified by the precision.  If the precision is zero or has not been specified, prints the  character  argument  until	it
	    encounters a null character.

       u    Convert  the  unsigned  integer argument to a decimal value.  The result must be in the range of 0 through 4294967295, where the upper
	    bound is defined by MAXUNIT.

       i    Convert the integer argument to decimal. (This conversion character is the same as d.)

       n    Store the number of characters formatted in the integer argument.

       p    Print the pointer to the argument. (This conversion character is the same as %08X).

       %    Print a percent sign ( % ). The function converts no argument.

       A non-existent or small field width never causes truncation of a value.	Padding takes place only if the specified field width exceeds  the
       length of the value.

       In  all	cases, the radix character uses is defined by the last successful call to category If category has not been called successfully or
       if the radix character is undefined, the radix character defaults to a period (.).

   International Environment
       LC_NUMERIC     If this environment is set and valid, uses the international language database named in the definition  to  determine  radix
		      character rules.

       LANG	      If  this environment variable is set and valid uses the international language database named in the definition to determine
		      collation and character classification rules.  If is defined, its definition supercedes the definition of LANG.

Restrictions
       The function cannot format values that exceed 128 characters.

Examples
       To print a date and time in the form Sunday, July 3, 10:02, where weekday and month are pointers to null-terminated strings use the follow-
       ing function call:
       printf("%s, %s %d, %02d:%02d",
		      weekday, month, day, hour, min);
       To print pi to 5 decimal places use the following call:
       printf("pi = %.5f", 4*atan(1.0));

Return Values
       In the BSD environment, and return zero for success and EOF for failure.  The subroutine returns its first argument for success and EOF for
       failure.

       In the System V and POSIX environments, and return the number of characters transmitted for success.  The function ignores the null  termi-
       nator () when calculating the number of characters transmitted.  If an output error occurs, these routines return a negative value.

See Also
       ecvt(3), nl_printf(3int), nl_scanf(3int), setlocale(3), putc(3s), scanf(3s), environ(5int)
       Guide to Developing International Software

																	printf(3s)
All times are GMT -4. The time now is 07:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy