Sponsored Content
Full Discussion: Non-integer caluclations
Top Forums UNIX for Dummies Questions & Answers Non-integer caluclations Post 302318649 by #moveon on Friday 22nd of May 2009 03:38:32 AM
Old 05-22-2009
Non-integer caluclations

Hey I am trying to calculate a number but I found out the expr I knew works only with integers. Any help. I want to calculate (120/220) *100.

Thanks!
 

10 More Discussions You Might Find Interesting

1. IP Networking

how to pass integer

i am writing a client and server program client program main() { int sockfd,n; char str; struct sockaddr_in sock; if ((sockfd=socket(AF_INET,SOCK_STREAM,0))<0) { perror("SOCKET ERROR"); } bzero(&sock,sizeof(sock)); sock.sin_family=AF_INET; (1 Reply)
Discussion started by: ramneek
1 Replies

2. Shell Programming and Scripting

get integer part

Hi, I did a df|awk| command and it returns a percentage "94%", how could I only get the integer part "94" out of it, so I can compare it to another number, I knwo that I have to pipe it to sth, but "grep " did not work, it still give me number WITH the percentage, does someone know what... (3 Replies)
Discussion started by: ericaworld
3 Replies

3. Shell Programming and Scripting

Cannot store integer value

Hi , I have code like below in my ksh script, but getting an error as SP2-0253: data item 1 ("SAMPLE_ID") will not fit on line , pls help me. thanks. if (( CHECKS == 0 )) || (( CHECKS == 1 )) then V_SAMPLE_ID=$( $ORACLE_HOME/bin/sqlplus -S / <<EOF whenever sqlerror exit 1... (5 Replies)
Discussion started by: bennichan
5 Replies

4. Shell Programming and Scripting

reverse an integer

i have created a script that will reverse any given ineter. #!/bin/ksh echo "Enter the number" read n if then a=`expr $n / 10` b=`expr $n % 10` c=`expr $b \* 10 + $a` fi echo $c --------------------------------------------------------------------- the problem with this script... (4 Replies)
Discussion started by: ali560045
4 Replies

5. UNIX for Dummies Questions & Answers

Integer check (again)...

I have search the forum for an easier way to write this code. I have two separate 'if' to do this and it works but am wondering if someone knows a quick way to combine them. I want anything between 1 and 100 but not '01' or '005', '0010', etc. if ) ]] || ]; then echo "Try... (3 Replies)
Discussion started by: giannicello
3 Replies

6. Shell Programming and Scripting

Alphanumeric to integer

Hi folks, I have a value like A12,i could able to change this into integer using typeset as below typeset -i A12 But, I need your advice to change the values like 1A2 or 12A into integer. Thanks in advance. Thanks, Sathish (3 Replies)
Discussion started by: bsathishmca
3 Replies

7. Solaris

How to Use a Variable as Integer?

hello, i am writing a script that takes the UID from the PASSWD and then i want to increse the Number by one. for the Next user. i cannot get this to work that a variable is as interger example: set i = 0 set $i = $+1 it's in tcsh if it's mather (10 Replies)
Discussion started by: shatztal
10 Replies

8. Linux

Wrong Integer value

I am migrating some shell script from Unix to Linux and i am getting wrong value for integer variable. In Unix: integer X=007300 echo $X 7300 In Linux: integer X=007300 echo $X 3776 Please help me why it is giving wrong output. (1 Reply)
Discussion started by: prav_chidugulla
1 Replies

9. Shell Programming and Scripting

how to compare string integer with an integer?

hi, how to I do this? i="4.000" if ; then echo "smaller" fi how do I convert the "4.000" to 4? Thanks! (4 Replies)
Discussion started by: h0ujun
4 Replies

10. Shell Programming and Scripting

String to integer

I am on HP-UX using ksh in the script. MaxSal=`sqlplus -silent /nolog <<EOF connect / as sysdba whenever sqlerror exit sql.sqlcode set pagesize 0 feedback off verify off heading off echo off select max(sal) from emp1; select max(sal) from emp2; select max(sal) from emp3; exit; EOF`... (3 Replies)
Discussion started by: bang_dba
3 Replies
Convert::Color::RGB16(3pm)				User Contributed Perl Documentation				Convert::Color::RGB16(3pm)

NAME
"Convert::Color::RGB16" - a color value represented as red/green/blue in 16-bit integers SYNOPSIS
Directly: use Convert::Color::RGB16; my $red = Convert::Color::RGB16->new( 65535, 0, 0 ); # Can also parse strings my $pink = Convert::Color::RGB16->new( '65535,49152,49152' ); # or $pink = Convert::Color::RGB16->new( 'ffffc000c000' ); Via Convert::Color: use Convert::Color; my $cyan = Convert::Color->new( 'rgb16:0,65535,65535' ); DESCRIPTION
Objects in this class represent a color in RGB space, as a set of three integer values in the range 0 to 65535; i.e. as 16 bits. For representations using floating point values, see Convert::Color::RGB. For representations using 8-bit integers, see Convert::Color::RGB8. CONSTRUCTOR
$color = Convert::Color::RGB16->new( $red, $green, $blue ) Returns a new object to represent the set of values given. These values should be integers between 0 and 65535. Values outside of this range will be clamped. $color = Convert::Color::RGB16->new( $string ) Parses $string for values, and construct a new object similar to the above three-argument form. The string should be in the form red,green,blue containing the three integer values in decimal notation. It can also be given in the form of a hex encoded string, such as would be returned by the "rgb16_hex" method: rrrrggggbbbb METHODS
$r = $color->red $g = $color->green $b = $color->blue Accessors for the three components of the color. ( $red, $green, $blue ) = $color->rgb16 Returns the individual red, green and blue color components of the color value in RGB16 space. $str = $color->hex Returns a string representation of the color components in the RGB16 space, in a convenient "RRRRGGGGBBBB" hex string. $mix = $color->alpha_blend( $other, [ $alpha ] ) Return a new color which is a blended combination of the two passed into it. The optional $alpha parameter defines the mix ratio between the two colors, defaulting to 0.5 if not defined. Values closer to 0 will blend more of $color, closer to 1 will blend more of $other. $mix = $color->alpha16_blend( $other, [ $alpha ] ) Similar to "alpha_blend" but works with integer arithmetic. $alpha should be an integer in the range 0 to 65535. $measure = $color->dst_rgb16( $other ) Return a measure of the distance between the two colors. This is the unweighted Euclidean distance of the three color components. Two identical colors will have a measure of 0, pure black and pure white have a distance of 1, and all others will lie somewhere inbetween. $measure = $color->dst_rgb16_cheap( $other ) Return a measure of the distance between the two colors. This is the sum of the squares of the differences of each of the color components. This is part of the value used to calculate "dst_rgb16", but since it involves no square root it will be cheaper to calculate, for use in cases where only the relative values matter, such as when picking the "best match" out of a set of colors. It ranges between 0 for identical colours and 3*(65535^2) for the distance between pure black and pure white. SEE ALSO
o Convert::Color - color space conversions AUTHOR
Paul Evans <leonerd@leonerd.org.uk> perl v5.12.3 2011-06-15 Convert::Color::RGB16(3pm)
All times are GMT -4. The time now is 08:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy