Sponsored Content
Top Forums Programming Representing INFINITY in C language???? Post 302601054 by Corona688 on Wednesday 22nd of February 2012 07:51:27 PM
Old 02-22-2012
And don't rule out the obvious:

Code:
$ cat inf.c
#include <stdio.h>

int main(void)  {       printf("%f\n", 1.0/0.0);        return(0);      }

$ gcc inf.c
$ ./a.out
inf

$

of course, that only works for floats. For integers, you're stuck with INT_MAX/LONG_MAX/etc. Since there's no possible integer higher than them for that type, they're as good as infinity for sorting purposes, even if they're not actually infinite.

Last edited by Corona688; 02-22-2012 at 09:01 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

A different language to me!

Hi all, I'm glad there's a section called UNIX for dummies on this forum cause when it comes to UNIX, I am certainly a dummie. I honestly don't have a clue about 98% of the UNIX commands out there so forgive me if this is a really stupid question. I'm trying to set up a MySQL server on my Mac... (7 Replies)
Discussion started by: kguenther
7 Replies

2. Programming

c language

is there any difference between "char*" and "char *" (1 Reply)
Discussion started by: amol munde
1 Replies

3. Programming

which language will be the best

Hello, Ive got to amke a script to calculate how many emails are in the servers mailbox, how many times each IP address appears in the mailbox and to search for keywords, tehn produce the results in HTML report. The thing is I dont know where to start and what the best language to use would be. ... (4 Replies)
Discussion started by: clueless
4 Replies

4. UNIX for Dummies Questions & Answers

What language is this?

Hi, Just got handed this script set def = HLA_DR.pockets set data = DRB1_1501.dat foreach a ( 'cat $data | args 3 |sort -u' ) cat $def | xC | grep -v $a > $$.def cat $data | grep $a | args 1,2 > $a.dat set pseudo = `cat MHCDR_pseudo.dat | grep HLA | grep $a | args 2`... (8 Replies)
Discussion started by: lost
8 Replies

5. Shell Programming and Scripting

Representing dir path for copy through env variable

Hello , i am on linux, and im trying to figure out why my cp command cant copy one file. I am trying to use variable in which i stored path to location where is file i wish to copy. $ echo $ORA_ALERT_LOG /u01/app/oracle/diag/rdbms/ring11/ring11/trace $ $ $ pwd /home/oracle $ cp -p... (2 Replies)
Discussion started by: tonijel
2 Replies

6. UNIX for Dummies Questions & Answers

sleep infinity

This might be one of the dumbest questions you've got, but please bear with me: I am a UNIX beginner. I had an test today and I was asked the following question: Q. How do you put the terminal into sleep indefinitely? I didn't know the answer, but after I came home, I tried the following... (9 Replies)
Discussion started by: indyxandy
9 Replies

7. Shell Programming and Scripting

File representing the hard disk storage device

I want example of a file representing the hard disk storage device In UNIX ? (6 Replies)
Discussion started by: tamer11007
6 Replies

8. Shell Programming and Scripting

awk Merging multiple files with symbol representing new file

I just tried following ls *.dat|sort -t"_" -k2n,2|while read f1 && read f2; do awk '{print}' $f1 awk FNR==1'{print $1,$2,$3,$4,$5,"*","*","*" }' OFS="\t" $f2 awk '{print}' $f2 donegot following result 18-Dec-1983 11:45:00 AM 18.692 84.672 0 25.4 24 18-Dec-1983 ... (3 Replies)
Discussion started by: Akshay Hegde
3 Replies

9. Programming

C language help URGENT !!!

I'am writing a program in C language and my code is working perfectly i just need to add a search to it ... My code lets users add companies, and then display them on screen... i would like to add a search that allows user to type company name and then displayall its info on the screen !! THANK... (1 Reply)
Discussion started by: aloushi
1 Replies

10. UNIX for Beginners Questions & Answers

Can't pass a variable representing the output of lsb_release to a docker dontainer

I don't know why, but the rendering of my code mucks up the spacing and indentation, despite being correct in the original file. I'm having issues getting the following script to run (specifically the nested script at the end of the docker command near the end of the script; I think I'm not passing... (2 Replies)
Discussion started by: James Ray
2 Replies
CACOS(3)						   BSD Library Functions Manual 						  CACOS(3)

NAME
cacos -- complex inverse cosine function SYNOPSIS
double complex cacos(double complex z); long double complex cacosl(long double complex z); float complex cacosf(float complex z); DESCRIPTION
cacos(z) computes the inverse cosine of the complex floating-point number z, with branch cuts outside the interval [-1,1] along the real axis. cacos() returns values in a strip of the complex plane with unbounded imaginary part, and real part in the interval [0, Pi]. For all complex floating point numbers z, cacos(conj(z)) = conj(cacos(z)). SPECIAL VALUES
The conjugate symmetry of cacos() is used to abbreviate the specification of special values. cacos(+-0 + 0i) returns Pi/2 - 0i. cacos(+-0 + NaN i) returns Pi/2 + NaN i. cacos(x + inf i) returns Pi/2 - inf i, for finite x. cacos(x + NaN i) returns NaN + NaN i, for finite nonzero x. cacos(-inf + yi) returns Pi - inf i, for finite positive-signed y. cacos(inf + yi) returns 0 - inf i, for finite positive-signed y. cacos(-inf + inf i) returns 3Pi/4 - inf i. cacos(inf + inf i) returns Pi/4 - inf i. cacos(+-inf + NaN i) returns NaN + inf i. cacos(NaN + yi) returns NaN + NaN i, for finite y. cacos(NaN + inf i) returns NaN - inf i. cacos(NaN + NaN i) returns NaN + NaN i. NOTES
SEE ALSO
complex(3) STANDARDS
The cacos() function conforms to ISO/IEC 9899:2011. 4th Berkeley Distribution December 11, 2006 4th Berkeley Distribution
All times are GMT -4. The time now is 09:04 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy