10-31-2011
Quote:
Originally Posted by
lamachejo
Hi guys, I want to add a list of SIGNED numbers... but I don't know how to tell the computer to ADD THEM as signed, let me explain further:
when adding 200 + (-100) , it becomes 100, but in asm the computer always add them as unsigned, so I always get the 300. Do I have to add them in a register, and do the two's complement ?
That doesn't sound like expected behavior at all...
How many bits are these numbers? Could they be wrapping?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I would like to write a script with BASH to add two numbers (integer) and write the result to the standard output. Please help! (7 Replies)
Discussion started by: Viper01
7 Replies
2. UNIX for Advanced & Expert Users
Hello, I have a file, and one column has both positive and negative numbers. Does anyone know how I can calculate the total of all the values (i.e, +ve and -ve).
eg:
col1 col2 col3
data 23 data
data 76 data
data -30 data
Thanks
Khoom (1 Reply)
Discussion started by: Khoomfire
1 Replies
3. UNIX for Dummies Questions & Answers
Hi this is quite a simple question... I am new to LINUX/UNIX and so I am just trying to create a very basic program. The idea is that when the user runs the program (from the shell) they enter 3 values and the program will add them up:
"./sum 23 5 1
29"
my code for this program is as follows:
... (4 Replies)
Discussion started by: csuieb
4 Replies
4. Shell Programming and Scripting
Hi All,
I have written the below to add the numbers in a column. Postive numbers are unsigned and negative numbers are signed in the file. After the below cmd I am getting -0.00 , instead of 0.00. Can someone guide me on what I am missing in the cmd.
grep '^L' $FileName| awk -F"|" ' {... (7 Replies)
Discussion started by: gsjdrr
7 Replies
5. UNIX for Advanced & Expert Users
Hey folks,
not sure whether this or the security board is the right forum. If I failed, please move :)
So here's the problem:
I need to build a Linux environment in which only "signed" processes are allowed to run. When I say signed I don't mean a VeriSign signature like you know it from... (5 Replies)
Discussion started by: disaster
5 Replies
6. Shell Programming and Scripting
Hi
I figured how to add my list of numbers. However how do I count so that after a certain number it lists the line.
Example:
12 test1
46 test2
195 test3
174 test4
634 test5
185 test6
94 test7
So basically add the numbers and when the addition reaches 300 or less
print the... (8 Replies)
Discussion started by: bombcan
8 Replies
7. Shell Programming and Scripting
I am writing a bash script on ubuntu11.10
I have some string having numbers and letter and want to add all the numbers together
For example
1s2d23f
I want to perform
1 + 2 + 23 and store it in a variable (3 Replies)
Discussion started by: kristinu
3 Replies
8. Shell Programming and Scripting
I have a file which has following contents which I want to add up.
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
139038.72
139038.72
139038.72
139038.72 (5 Replies)
Discussion started by: aksijain
5 Replies
9. UNIX for Dummies Questions & Answers
Hello. Trying to add a column of numbers and combine the 1st and 2nd fields as uniq with the new total.
This works to add the numbers but can't figure an easy was to combine the 1st and 2nd column as the list is very long. awk '{s+=$3} END {print s}'
bird dog 300
bird dog 100
cat clown 200... (1 Reply)
Discussion started by: jimmyf
1 Replies
10. Shell Programming and Scripting
Hi again. Sorry for all the questions — I've tried to do all this myself but I'm just not good enough yet, and the help I've received so far from bartus11 has been absolutely invaluable. Hopefully this will be the last bit of file manipulation I need to do.
I have a file which is formatted as... (4 Replies)
Discussion started by: crunchgargoyle
4 Replies
LEARN ABOUT PHP
imageantialias
IMAGEANTIALIAS(3) 1 IMAGEANTIALIAS(3)
imageantialias - Should antialias functions be used or not
SYNOPSIS
bool imageantialias (resource $image, bool $enabled)
DESCRIPTION
Activate the fast drawing antialiased methods for lines and wired polygons. It does not support alpha components. It works using a direct
blend operation. It works only with truecolor images.
Thickness and styled are not supported.
Using antialiased primitives with transparent background color can end with some unexpected results. The blend method uses the background
color as any other colors. The lack of alpha component support does not allow an alpha based antialiasing method.
PARAMETERS
o $
image -An image resource, returned by one of the image creation functions, such as imagecreatetruecolor(3).
o $enabled
- Whether to enable antialiasing or not.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
EXAMPLES
Example #1
A comparison of two lines, one with anti-aliasing switched on
<?php
// Setup an anti-aliased image and a normal image
$aa = imagecreatetruecolor(400, 100);
$normal = imagecreatetruecolor(200, 100);
// Switch antialiasing on for one image
imageantialias($aa, true);
// Allocate colors
$red = imagecolorallocate($normal, 255, 0, 0);
$red_aa = imagecolorallocate($aa, 255, 0, 0);
// Draw two lines, one with AA enabled
imageline($normal, 0, 0, 200, 100, $red);
imageline($aa, 0, 0, 200, 100, $red_aa);
// Merge the two images side by side for output (AA: left, Normal: Right)
imagecopymerge($aa, $normal, 200, 0, 0, 0, 200, 100, 100);
// Output image
header('Content-type: image/png');
imagepng($aa);
imagedestroy($aa);
imagedestroy($normal);
?>
The above example will output something similar to:[NOT DISPLAYABLE MEDIA]Output of example : A comparison of two lines, one with
anti-aliasing switched on
NOTES
SEE ALSO
imagecreatetruecolor(3).
PHP Documentation Group IMAGEANTIALIAS(3)