Sponsored Content
Full Discussion: math.h: float ceilf(float x)
Top Forums Programming math.h: float ceilf(float x) Post 302121468 by jonas.gabriel on Thursday 14th of June 2007 03:02:00 AM
Old 06-14-2007
math.h: float ceilf(float x)

Good morning,

I'm testing the use of ceilf:
Code:
/*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;
}

Compiling, I get
Code:
root@slackware:~/ncurses# gcc str.c -o tester
/tmp/cc6C3DIO.o(.text+0x30): In function `main':
: undefined reference to `ceilf'
collect2: ld returned 1 exit status

Can somebody find my error ? I've tested in 2 machines...
Thank you in advance.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

float comparison

I had a variable 1:80 8 in one varialbe say var=1:80 8 i comapred the below if then -- else ---- thought if condition is true its always going in the else condition....its not giving any compilation errror also....is there any problem bcoz of space... can some one help... (3 Replies)
Discussion started by: mkan
3 Replies

2. UNIX for Dummies Questions & Answers

Float calculations

As expr is used for integer calculations, which command is used for float calculations. (1 Reply)
Discussion started by: sharmavr
1 Replies

3. UNIX for Dummies Questions & Answers

Dividing float values

Hi I know its a dumb question but can any one please explain me the difference of executing a shell script in the following 2 ways. . script.sh sh script.sh I have a problem if I execute the following code as sh script.sh DB_CNT_ALW=0.20 SCT_VAR=0.05 if ; then echo "== Difference... (3 Replies)
Discussion started by: shash
3 Replies

4. Programming

max precision in float

Hi, As all of us know that size of int is machine as well as compiler dependent we can get the range and size of an int , float and char etc in /usr/include/limits.h header file of a compiler but could any one tell me how to get info of precision of float and ... (6 Replies)
Discussion started by: useless79
6 Replies

5. Shell Programming and Scripting

Float and Double in Perl

HI! What is the notation which correspond to C's doubleandfloatin Perl?? Please tell me. Thanks. Well what I want to do is, for example, calculatingsqrt(2)in two way: float and double. (5 Replies)
Discussion started by: Euler04
5 Replies

6. Shell Programming and Scripting

float input

how to input float data type in bash shell programming in linux? I am new to it so unaware to use the commands plz help me out. thank you. (6 Replies)
Discussion started by: purva
6 Replies

7. Programming

Float issues

i am adding two floating point numbers and i want to store in a character pointer... float f1 ; float f2 ; char *c = NULL; printf("Enter 2 floating numbers\n"); scanf("%f %f",&f1,&f2); f1 = f1+f2; sprintf(c, "%f", f1 ); when i execute this, i am... (3 Replies)
Discussion started by: pgmfourms
3 Replies

8. Shell Programming and Scripting

float to normal

I have a file with 2 columns . One of the line looks like the following. Is it possible to convert every float no in column 2 to integer. input NM_032881 6.03787973608527e-05 output 0.0000603787..... (2 Replies)
Discussion started by: quincyjones
2 Replies

9. Red Hat

What is float IP?

:confused:We have two servers one active and one stand by as follows Active 202.61.9.9 Stand by 202.61.9.10 Float IP 202.61.9.8 What is use of this float IP? How it is configured? (1 Reply)
Discussion started by: manalisharmabe
1 Replies

10. Programming

Printing float values in C

Hi, I have small problem to print float value in the fallowing code float Cx, W,f=250000, Cr=92.00,pi=3.14; W=2*pi*f; Cx = 1/W.Cr; //Cx value will be come around like 7.07E-9. printf("capacitance value: %.10f",Cx); I am trying to print Cx value using above code but it was not... (3 Replies)
Discussion started by: veerubiji
3 Replies
CEIL(3) 						     Linux Programmer's Manual							   CEIL(3)

NAME
ceil, ceilf, ceill - ceiling function: smallest integral value not less than argument SYNOPSIS
#include <math.h> double ceil(double x); float ceilf(float x); long double ceill(long double x); Link with -lm. Feature Test Macro Requirements for glibc (see feature_test_macros(7)): ceilf(), ceill(): _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 600 || _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L; or cc -std=c99 DESCRIPTION
These functions return the smallest integral value that is not less than x. For example, ceil(0.5) is 1.0, and ceil(-0.5) is 0.0. RETURN VALUE
These functions return the ceiling of x. If x is integral, +0, -0, NaN, or infinite, x itself is returned. ERRORS
No errors occur. POSIX.1-2001 documents a range error for overflows, but see NOTES. ATTRIBUTES
Multithreading (see pthreads(7)) The ceil(), ceilf(), and ceill() functions are thread-safe. CONFORMING TO
C99, POSIX.1-2001. The variant returning double also conforms to SVr4, 4.3BSD, C89. NOTES
SUSv2 and POSIX.1-2001 contain text about overflow (which might set errno to ERANGE, or raise an FE_OVERFLOW exception). In practice, the result cannot overflow on any current machine, so this error-handling stuff is just nonsense. (More precisely, overflow can happen only when the maximum value of the exponent is smaller than the number of mantissa bits. For the IEEE-754 standard 32-bit and 64-bit floating- point numbers the maximum value of the exponent is 128 (respectively, 1024), and the number of mantissa bits is 24 (respectively, 53).) The integral value returned by these functions may be too large to store in an integer type (int, long, etc.). To avoid an overflow, which will produce undefined results, an application should perform a range check on the returned value before assigning it to an integer type. SEE ALSO
floor(3), lrint(3), nearbyint(3), rint(3), round(3), trunc(3) COLOPHON
This page is part of release 3.53 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. 2013-06-21 CEIL(3)
All times are GMT -4. The time now is 10:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy