Sponsored Content
Top Forums Programming comparison between float numbers Post 302302564 by jim mcnamara on Tuesday 31st of March 2009 10:21:33 AM
Old 03-31-2009
7.12.14 Comparison macros - in C standards require that there be macros to handle float comparisons correctly. I think you want isgreater(). Review your math man page for details.

Also when you print a float, depending on the format specification, the [f]printf routine rounds numbers. Example 1.999999 becomes 2
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

adding float numbers

how to add 2 float values to each other? i tried this and it doesnt work: #!bin/bash numone=1.234 numtwo=0.124 total=`expr $numone + $numtwo` echo $total thanks (5 Replies)
Discussion started by: strike
5 Replies

2. 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

3. UNIX for Advanced & Expert Users

perl: string comparison as numbers

$name = 'Mark'; $goodguy = 'Tody'; if ($name == $goodguy) { print "Hello, Sir.\n"; } else { print "Begone, evil peon!\n"; } The output is Hello, Sir...... Even if the Mark is made to MarkSpencer.....then also it shows as Hello, Sir.... Can any one explain the... (7 Replies)
Discussion started by: bishweshwar
7 Replies

4. Solaris

i cannot assign float point numbers to an array in solaris

total=0 declare -a sum limit=`iostat -En | grep -i size | awk '{print $2}' | sed -e 's/GB//g' | wc -l` echo "Limit is equal to $limit" ara="`iostat -En | grep -i size | awk '{print $2}' | sed -e 's/GB//g'`" for (( i=1; i<=$limit; i++ )) do sum=`echo $ara | cut -d " " -f $i` echo ${sum}... (11 Replies)
Discussion started by: naree
11 Replies

5. Solaris

can array store float point numbers

Hi all, I have doubt can array in a shell script can store floating point numbers. i have tired. but i unable to work it out. Please help me regarding this Thank U Naree (1 Reply)
Discussion started by: naree
1 Replies

6. Shell Programming and Scripting

numbers comparison in fields of a file and print least value of them

Hi , I'm trying to compare fields in the file, I want compare the numbers in each column and get the least value of it. > cat input_file 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 -0.2050 -0.6629 -0.6407 -0.6599 -0.4085 -0.3959 -0.2526 -0.3597 0.3439 0.2275 0.2780 ... (5 Replies)
Discussion started by: novice_man
5 Replies

7. Shell Programming and Scripting

Random float numbers in BASH

Hi people :) I'm learning shell scripting using bash and I want to generate 4 floating point number with 5 decimal places and write them to a file and a variable. I've done all this except the $RAMDOM enviroment variable does not generate a float number but a integrer. I hope you could... (3 Replies)
Discussion started by: pharaoh
3 Replies

8. Shell Programming and Scripting

Help about using variables of float numbers in sed

Hi, I need to run a Fortran program which reads a input file with a fixed name many times, each time I need to change a number (real) in that input file, this is how I currently do it and I know it is not elegent at all: cp inputfile.dat backup.dat sed -i 's/28.0/0.01/g' inputfile.dat ./myCode... (3 Replies)
Discussion started by: dypang
3 Replies

9. Shell Programming and Scripting

Comparison of floating point numbers in bash

I have the following code snippet in bash if ]; then minm=`echo "$diff" | bc` fi It works well for most of the cases. However lets say diff is -0.17 and minm is -0.0017. In such a case the comparison seems to fail. Is the correct way to compare a mixture of positive and... (12 Replies)
Discussion started by: ngabrani
12 Replies
SWFDISPLAYITEM(3)							 1							 SWFDISPLAYITEM(3)

The SWFDisplayItem class

INTRODUCTION
SWFDisplayItem. CLASS SYNOPSIS
SWFDisplayItem SWFDisplayItem Methods o void SWFDisplayItem::addAction (SWFAction $action, int $flags) o void SWFDisplayItem::addColor (int $red, int $green, int $blue, [int $a]) o void SWFDisplayItem::endMask (void ) o float SWFDisplayItem::getRot (void ) o float SWFDisplayItem::getX (void ) o float SWFDisplayItem::getXScale (void ) o float SWFDisplayItem::getXSkew (void ) o float SWFDisplayItem::getY (void ) o float SWFDisplayItem::getYScale (void ) o float SWFDisplayItem::getYSkew (void ) o void SWFDisplayItem::move (float $dx, float $dy) o void SWFDisplayItem::moveTo (float $x, float $y) o void SWFDisplayItem::multColor (float $red, float $green, float $blue, [float $a]) o void SWFDisplayItem::remove (void ) o void SWFDisplayItem::rotate (float $angle) o void SWFDisplayItem::rotateTo (float $angle) o void SWFDisplayItem::scale (float $dx, float $dy) o void SWFDisplayItem::scaleTo (float $x, [float $y]) o void SWFDisplayItem::setDepth (int $depth) o void SWFDisplayItem::setMaskLevel (int $level) o void SWFDisplayItem::setMatrix (float $a, float $b, float $c, float $d, float $x, float $y) o void SWFDisplayItem::setName (string $name) o void SWFDisplayItem::setRatio (float $ratio) o void SWFDisplayItem::skewX (float $ddegrees) o void SWFDisplayItem::skewXTo (float $degrees) o void SWFDisplayItem::skewY (float $ddegrees) o void SWFDisplayItem::skewYTo (float $degrees) PHP Documentation Group SWFDISPLAYITEM(3)
All times are GMT -4. The time now is 11:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy