I have the following expression:
#define GB (1024 * 1024 * 1024)
#define TB (1024 * GB)
#define MAX_SIZE (3 * TB)
off_t current_size;
And then the expression...
if (current_size > MAX_SIZE)
{
... (1 Reply)
Hy
Stupid question, I know. But I can't get the Solution. As I know C / Java / PHP and other languages I can't get the point with ksh :o.
in a while/do iteration I like to count up an integer counter. but
counter++ doesn't work, also counter=$counter+1 echoes me 0+1+1 when I iterate 2... (3 Replies)
hi, i am trying some awk arthmatic calculation,i have a problem if any one can help
let say if i have a file
exm.txt
3 + 2
3 * 2
3 / 2
3 - 2
the output expected is
awk -f exm.awk exm.txt
3 + 2 = 5
3 * 2 = 6
3 / 2 = 1.5
3 - 2 = 1
i simply used exm.awk
{
print $1 " + " $3 "= " $1 +... (3 Replies)
Hi Everyone!
I'm trying to do simple math on a single command line instead of a script which I've already set up using let etc. I can not get the same output to display on a command line.
Essentially I would like a=20, b=50, and c=a*b.
When I tried:
let "A=20, B=50"; let C=A*B; echo $C
... (2 Replies)
Hi,
I am just trying to compare integer in ksh. can you please tell me what's wrong with this code... or give me suggestions on alternative.
sample code:
i=0;
if ; then
echo inside if
fi
Thanks in advance! (6 Replies)
Hi,
This is confusing me and I would appreciate some help.
Consider this script
#!/bin/ksh
typset -i stat=`ls -l $WORK/stat |wc -l`
if (( $stat < 20 ))
then
echo true
else
echo false
fi
If the value of $stat is say 29. When I run this above it echos true and not false.... (7 Replies)
Hi Guys,
I am relatively new to scripting at the moment and am struggling to get the following function to work. For some reason it does not recognise the arithmatic symbol when i select option1. Any help would be greatly appreciated.
menu ()
{
echo "=============="
echo "Calculator"... (4 Replies)
Discussion started by: somersetdan
4 Replies
LEARN ABOUT FREEBSD
fixmul
fixmul(3alleg4) Allegro manual fixmul(3alleg4)NAME
fixmul - Multiplies two fixed point values together. Allegro game programming library.
SYNOPSIS
#include <allegro.h>
fixed fixmul(fixed x, fixed y);
DESCRIPTION
A fixed point value can be multiplied or divided by an integer with the normal `*' and `/' operators. To multiply two fixed point values,
though, you must use this function.
If an overflow occurs, `errno' will be set and the maximum possible value will be returned, but `errno' is not cleared if the operation is
successful. This means that if you are going to test for overflow you should set `errno=0' before calling fixmul(). Example:
fixed result;
/* This will put 30000 into `result'. */
result = fixmul(itofix(10), itofix(3000));
/* But this overflows, and sets `errno'. */
result = fixmul(itofix(100), itofix(3000));
ASSERT(!errno);
RETURN VALUE
Returns the clamped result of multiplying `x' by `y', setting `errno' to ERANGE if there was an overflow.
SEE ALSO fixadd(3alleg4), fixsub(3alleg4), fixdiv(3alleg4), ex3buf(3alleg4), excustom(3alleg4), exfixed(3alleg4), exspline(3alleg4), exs-
tars(3alleg4), exupdate(3alleg4)Allegro version 4.4.2 fixmul(3alleg4)