Sponsored Content
Full Discussion: floating point problem
Top Forums Programming floating point problem Post 302109587 by matrixmadhan on Tuesday 6th of March 2007 11:15:22 PM
Old 03-07-2007
Code:
#include <stdio.h>

int main()
{
  int i;
  float f=1.0;

  for( i=0; i<9; i++, f /= 10 ) {
    printf("%10.8f\n", f);
  }
  return 0;
}

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

problem with floating point numbers in awk

hi all, i have the following problem using awk in a script i want to read the values from a column with real numbers and calculate the mean.the problem is that when i use a statement such as this num = $4 i cant find a way to convert the variable from string to floating point to perform... (7 Replies)
Discussion started by: kanagias
7 Replies

2. Shell Programming and Scripting

floating point addition

hi, :) I have a file like this 10.456 123.567 456.876 234.987 ........ ....... What i want to do is ia have to add all those numbers and put the result in some other file. Any help pls. cheers RRK (8 Replies)
Discussion started by: ravi raj kumar
8 Replies

3. Linux

Floating point exception !!!

Hi, I have linux fedora 4 ver., 2.6 kernal. And qmail & mysql & samba servers are already configured on this server. When I try to install any package like squidguard ,dansguardian,webmin,rsnapshots with command rpm -ivh . It is giving error as “Floating point exception" Snap View is... (3 Replies)
Discussion started by: ssk01
3 Replies

4. Linux

Floating Point Exception

Hi, I am compiling "HelloWorld" C progam on 32-bit CentOS and i want to execute it on 64-bit CentOS architecture. For that i copied the a.out file from 32-bit to 64-bit machine, but while executing a.out file on 64bit machine I am getting "Floating point exception error". But we can run... (3 Replies)
Discussion started by: Mandar123
3 Replies

5. Programming

Floating point Emulator

what is floating point emulator(FPE)? where and why it is used? (1 Reply)
Discussion started by: pgmfourms
1 Replies

6. Shell Programming and Scripting

how to compare 2 floating point no.

Hi, Could any one tell me how to compare to floating point no. using test command. As -eq option works on only intergers. i=5.4 if then echo "equal" else echo "not equal" fi here output will be equal even though no. are unequal. Thanks, ravi (1 Reply)
Discussion started by: useless79
1 Replies

7. Shell Programming and Scripting

floating point numbers in if

# if > then > echo "1" > else > echo "2" > fi -bash: How can i compare floating point numbers inside statement? (15 Replies)
Discussion started by: proactiveaditya
15 Replies

8. Shell Programming and Scripting

floating point number problem

Hello folks I Hope everyone is fine. I am calculating number of bytes calculation from apache web log. awk '{ sum += $10 } END { print sum }' /var/httpd/log/mydomain.log 7.45557e+09 it show above number, what should i do it sow number like 7455, i mean if after decimal point above 5 it... (5 Replies)
Discussion started by: learnbash
5 Replies

9. Shell Programming and Scripting

problem with floating point number loops

Hey, I guess I am just to stupid and am not seeing the "wood for the trees", but I am always getting strange errors. I want to create a mesh with coordinates like: x y z 3.1 3.0 0.75 0 0 1 3.1 2.9 0.75 0 0 1 3.1 2.8 0.75 0 0 1 3.1 2.7 0.75 0 0 1 3.0 ... (10 Replies)
Discussion started by: ergy1983
10 Replies

10. Programming

Floating Point

Anyone help me i cant found the error of floating point if needed, i added the code complete #include <stdio.h> #include <string.h> #include <stdlib.h> #include <ctype.h> typedef struct { int hh; int mm; int ss; char nom; int punt; }cancion; typedef struct... (9 Replies)
Discussion started by: Slasho
9 Replies
FEGETENV(3)						   BSD Library Functions Manual 					       FEGETENV(3)

NAME
fegetenv, feholdexcept, fesetenv, feupdateenv -- functions providing access to the floating-point environment. SYNOPSIS
#include <fenv.h> #pragma STDC FENV_ACCESS ON int fegetenv(fenv_t *envp); int feholdexcept(fenvt_t *envp); int fesetenv(fenv_t *envp); int feupdateenv(fenv_t *envp); DESCRIPTION
These functions provide the means to manage the entire floating-point environment--including both status flags and control modes--as a single entity. The fegetenv() function attempts to store the current floating-point environment in the object pointed to by envp. It returns zero if the environment was successfully stored, and a nonzero value otherwise. The feholdexcept() function saves the current floating-point environment in the object pointed to by envp, clears the floating-point status flags, and then installs a "non-stop" mode, if available, under which no traps are taken for floating-point exceptions (as is the case in default IEEE-754 floating-point execution). It returns zero if and only if such a mode was successfully installed. The fesetenv() function attempts to establish the floating-point environment represented by the object pointed to by envp. This object shall have been set by a call to fegetenv() or feholdexcept(), or be equal to a floating-point environment macro defined in <fenv.h>. Note that this function merely installs the floating-point status flags represented by its argument, and does not raise the corresponding floating- point exceptions. It returns zero if and only if the environment pointed to by envp was successfully installed. The feupdateenv() function attempts to save the currently raised floating-point flags, install the floating-point environment represented by *envp, and then raise the floating-point exceptions corresponding to the saved flags. The object pointed to by envp shall have been set by a call to fegetenv() or feholdexcept(), or be equal to a floating-point environment macro defined in <fenv.h>. It returns zero if and only if all of the specified actions were successfully carried out. SEE ALSO
fenv(3), feclearexcept(3), fegetexceptflag(3), fegetround(3), feraiseexcept(3), fesetexceptflag(3), fesetround(3), feraiseexcept(3) STANDARDS
These functions conform to ISO/IEC 9899:TC3. BSD
May 9, 2011 BSD
All times are GMT -4. The time now is 06:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy