Hello,
I'm trying to write a while loop for a decimal value in tcsh which I know can't be done. Instead I want my increments to be one order of magnitude too large and then divide it by 10 when I use the variable. However, I don't know how to divide my variable and set it as another.
I then want to set PI to equal RI/10 to use PI in another program so my PI values will range from 1.0 to 3.0.
Thanks
Last edited by Scott; 01-19-2010 at 11:48 AM..
Reason: Please use code tags
Heres a script i wrote as a bit of practise. What it does is insert a line in the middle of a file. The line being $1 and the file being $2
#!/bin/bash
rm tempfile
touch tempfile
count=1
linenum= `wc -l < $2`
if
then
echo $1 >> $2
else
even=`expr "$linenum" % 2`
if
then... (3 Replies)
Hello everybody,
I am having problem in converting byte array variables to Hexa String variables for Linux. I have done, converting byte array variables to Hexa String variables for Windows but same function doesn't work for linux. Is there any difference in OS ? The code for Windows is given... (2 Replies)
if input to the perl program is ' ( p * ((a+b) * (c+d))) + q ' it shuld give the output as ' pac + pad + pbc + pbd + q ' .can anyone suggest a way to do this ? (7 Replies)
Hi All
I've made a few scripts which using GDAL extract the value of a pixel within a given raster. The purpose is to work out the combine value of every pixel. I thought there may have been an easier way to do this but alas!
The code below extracts the pixel value at position X Y. The... (3 Replies)
Hi, I am trying to make a maths calculator that:
1. Prompts the user for a number.
2. Prompts the user for an operation (add, subtract, divide or multiply)
3. Prompts the user for a number.
4. Prompts the user for another operation (same as above) OR the option to get the result for the... (4 Replies)
Hi,
Need help on this. I need to increment a variable by 1 but retain as 2 characters.
I am using expr to do additions:
NEWSERIAL=`expr $SERIAL + 1`
$SERIAL can range from 01-99. After adding "1", I need the result to be 2 characters, eg: 02+1 = 03. By default expr will truncate the... (4 Replies)
Hi All,
i have a requirement where i have to run a script with at least 25 arguements and position of arguements can also change. the unapropriate way is like below. can we achieve this in more good and precise way??
#!/bin/ksh
##script is sample.ksh
age=$1
gender=$2
class=$3
.
.
.... (3 Replies)
Sometimes it is handy to protect long scripts in C++.
The following syntax works fine for simple commands:
#define SHELLSCRIPT1 "\
#/bin/bash \n\
echo \"hello\" \n\
"
int main ()
{
cout <<system(SHELLSCRIPT1);
return 0;
}
Unfortunately for there are problems for:
1d arrays:... (10 Replies)
Hi guys...
I am loving this integer maths thing.
64 bit systems are certainly easier than 32 bit, but hey, I don't intend to leave out my fav' platform.
Using one of the 'Brothers' methods, URL inside the code.
#!/bin/sh
#
# #!/usr/local/bin/dash
# e_constant.sh
# Brother's formula .
#... (2 Replies)
Discussion started by: wisecracker
2 Replies
LEARN ABOUT MOJAVE
gamma_r
TGAMMA(3) BSD Library Functions Manual TGAMMA(3)NAME
tgamma, lgamma, gamma -- gamma and log of gamma
SYNOPSIS
#include <math.h>
double
tgamma(double x);
long double
tgammal(long double x);
float
tgammaf(float x);
double
lgamma_r(double x, int *psigngam);
long double
lgammal_r(long double x, int *psigngam);
float
lgammaf_r(float x, int *psigngam);
double
lgamma(double x);
long double
lgammal(long double x);
float
lgammaf(float x);
DESCRIPTION
tgamma() calculates the gamma function of x. lgamma() calculates the natural logorithm of the absolute value of the gamma function of x.
gamma() is the same function as tgamma. Its use is deprecated.
lgamma_r() is a thread-safe alternative to lgamma(). Instead of setting the global variable signgam, it stores the sign of Gamma(x) in the
location pointed to by its second argument. In order to use the lgamma_r() function, define the macro _REENTRANT before including <math.h>.
SPECIAL VALUES
tgamma(+-0) returns +-infinity and raises the "divide-by-zero" floating-point exception.
tgamma(x) returns a NaN and raises the "invalid" floating-point exception if x is a negative integer.
tgamma(-infinity) returns a NaN and raises the "invalid" floating-point exception.
tgamma(+infinity) returns +infinity.
tgamma(x) generates a domain error if x is a negative integer or if the result cannnot be respresented when x is 0.
A range error may occur if the magnitude of x is too large or too small.
lgamma(1) returns +0.
lgamma(2) returns +0.
lgamma(x) returns +infinity and raises the "divide-by-zero" floating-point exception if x is a negative integer or 0.
lgamma(+-infinity) returns +infinity.
lgamma(x) generates a range error if x is too large.
A range error may occur if x is a negative integer or 0.
NOTE
lgamma(x) and its variants have the (non-threadsafe) side-effect of setting the global variable signgam to +-1, equal to the sign of
tgamma(x). lgamma_r(x, psigngam) instead sets the user-allocated integer pointed to by the psigngam argument.
gamma() and gamma_r() are deprecated, and should not be used. The tgamma() function should be used instead. Note, however, that on some
platforms, gamma() and gamma_r() historically computed the log of the Gamma function, instead of the Gamma function itself. When porting
code from such platforms, it will be necessary to use lgamma() or lgamma_r() instead.
SEE ALSO math(3)STANDARDS
The tgamma() , and lgamma() functions conform to ISO/IEC 9899:2011.
July 02, 2008