Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

sin(2) [plan9 man page]

SIN(2)								System Calls Manual							    SIN(2)

NAME
sin, cos, tan, asin, acos, atan, atan2 - trigonometric functions SYNOPSIS
#include <u.h> #include <libc.h> double sin(double x) double cos(double x) double tan(double x) double asin(double x) double acos(double x) double atan(double x) double atan2(double y, double x) DESCRIPTION
Sin, cos and tan return trigonometric functions of radian arguments. The magnitude of the argument should be checked by the caller to make sure the result is meaningful. Asin returns the arc sine in the range -n/2 to n/2. Acos returns the arc cosine in the range 0 to n. Atan returns the arc tangent in the range -n/2 to n/2. Atan2 returns the arc tangent of y/x in the range -n to n. SOURCE
/sys/src/libc/port SEE ALSO
intro(2) BUGS
The value of tan for arguments greater than about 2^-31 is garbage. SIN(2)

Check Out this Related Man Page

sin(3m) 																   sin(3m)

Name
       sin, cos, tan, asin, acos, atan, atan2 - trigonometric functions and their inverses

Syntax
       #include <math.h>

       double sin(x)
       double x;

       float fsin(x)
       float x;

       double cos(x)
       double x;

       float fcos(x)
       float x;

       double tan(x)
       double x;

       float ftan(x)
       float x;

       double asin(x)
       double x;

       float fasin(x)
       float x;

       double acos(x)
       double x;

       float facos(x)
       float x;

       double atan(x)
       double x;

       float fatan(x)
       float x;

       double atan2(y,x)
       double y,x;

       float fatan2(y,x)
       float y,x;

Description
       The and functions return trigonometric functions of radian arguments x for double data types.

       The and functions return trigonometric functions for float data types.

       The and functions return the arc sine in the range -pi/2 to pi/2 for double and float data types, respectively.

       The and functions return the arc cosine in the range 0 to pi for double and float data types, respectively.

       The and functions return the arc tangent in the range -pi/2 to pi/2 for double and float data types, respectively.

       The  and  functions  return  the  arc tangent of y/x in the range -pi to using the signs of both arguments to determine the quadrant of the
       return value for double and float data types, respectively.

   Error (due to roundoff)
       When P stands for the number stored in the computer in place of pi = 3.14159 26535 89793 23846 26433 ... .  and "trig" stands  for  one	of
       "sin",  "cos"  or  "tan",  then	the  expression  "trig(x)" in a program actually produces an approximation to trig(x*pi/P), and "atrig(x)"
       approximates (P/pi)*atrig(x).  The approximations are close.

       P differs from pi by a fraction of an ulp; the difference is apparent only if the argument x is huge,  and  even  then  the  difference	is
       likely  to  be swamped by the uncertainty in x.	Every trigonometric identity that does not involve pi explicitly is satisfied equally well
       regardless of whether P = pi.  For example, sin(x)**2+cos(x)**2 = 1 and sin(2x) = 2sin(x)cos(x) to within a few ulps regardless of how  big
       x is.  Therefore, the difference between P and pi is unlikely to effect scientific and engineering computations.

Return Values
       All the double functions return NaN if NaN is passed in.

       If |x| > 1 then (x) and (x) will return the default quiet NaN.

       The function defines (0,0) = NaN.

See Also
       hypot(3m), math(3m), sqrt(3m)

								       RISC								   sin(3m)
Man Page

13 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Editing a file using a script

Hi I have about 10 config files belonging to software that runs on SCO UNIX. These files contain, amongst many other things, a path which points to the software locations. We normally have to change them manually every time the software is coppied to a new location and when you gotta do a few... (45 Replies)
Discussion started by: Ypnos
45 Replies

2. Shell Programming and Scripting

Parse a string in XML file using shell script

Hi! I'm just new here and don't know much about shell scripting. I just want to ask for help in creating a shell script that will parse a string or value of the status in the xml file. Please sample xml file below. Can you please help me create a simple script to get the value of status? Also it... (46 Replies)
Discussion started by: ayhanne
46 Replies

3. Shell Programming and Scripting

Passing Arguments in Shell Scripts

Hello everybody! First time posting here:) Right, I am trying to pass arguments in my shell scripts using $1, $2 and $3 etc using if else statement........ This is my shell script which is based on serching the google website #!/bin/sh wget -t1 -E -e robots=off - -awGet.log -T 200 -H... (47 Replies)
Discussion started by: kev_1234
47 Replies

4. UNIX for Dummies Questions & Answers

Using "find" and "-exec rm" ... Just no luck :(

Hi All, Ok, so I'm fairly new to Unix, but would like to think I'm grasping things fairly ok (Well until now ;) ), BUT with this one I'm going in circles ... LOL .. really can't work out why? So sorry for this post if it seems a little "dumb" .. But here goes. In short I'd like to achieve the... (55 Replies)
Discussion started by: Dean Rotherham
55 Replies

5. Shell Programming and Scripting

Include white spaces while using CUT command

Hi I tried to extract 19 characters (default) enclosed with in tag from a file using cut command. If the characters comprises of double space, the cut command gives the output with a single spacing. file 1 <name>Kumar Rajasekaran</name> cut -c7-26 "file1" the out put i received is ... (48 Replies)
Discussion started by: Sekar1
48 Replies

6. Shell Programming and Scripting

Need to create a simple script using MD5, SSH...

Hi all, I am brand new to these forums and I am a brand new UNIX Administartor. Don't know any scripting yet :wall:, and would like to learn as my boss is slowly letting me understand everything about being a Sys/*Nix Admin. He created this script which I am trying to replicate because I lost it... (54 Replies)
Discussion started by: zixzix01
54 Replies

7. Shell Programming and Scripting

Using arrays in bash using strings to bash built-in true

I have the following code and for some reason when I call the program using /home/tcdata/tatsh/trunk/hstmy/bin/bash/raytrac.bash --cmod=jcdint.cmod I get hasArgument = hasArgument = true Somehow the array element is returning even though I have not chosen the option. ... (41 Replies)
Discussion started by: kristinu
41 Replies

8. Shell Programming and Scripting

passing argument from one function to another

Hi all, In the given script code . I want to pass the maximum value that variable "i" will have in function DivideJobs () to variable $max of function SubmitCondorJob(). Any help? Thanks #!/bin/bash ... (55 Replies)
Discussion started by: nrjrasaxena
55 Replies

9. Shell Programming and Scripting

Help me pls : splitting single file in unix into different files based on data

I have a file in unix with sample data as follows : -------------------------------------------------------------- -------------------------------------------------------------- {30001002|XXparameter|Layout|$ I want this file to be splitted into different files and corresponding to the sample... (54 Replies)
Discussion started by: Ravindra Swan
54 Replies

10. Shell Programming and Scripting

FTP search ,grep using perl

Need assistance on a Perl script. I have a list of file names in a file and would like to search/grep the same names in the list of files on the ftp server and output to a file. Any help is appreciable Below is the script that can give me the list of files,size of file, Modified date on the... (56 Replies)
Discussion started by: ajayram_arya
56 Replies

11. Shell Programming and Scripting

Csv file parsing and validating

Hi, I have basic knowledge on unix shell scripting(not an expert). My requirement is reading the csv file using the schema defined in the configuration file and if the condition is not mached then move the unmatched record to a error file and matched good records into other file. In brief: ... (43 Replies)
Discussion started by: shree11
43 Replies

12. Programming

Appending a column in xlsx file using Python

Is there a way to append an existing xlsx worksheet to add data from a text file ? I have an excel file for which I need to manipulate the first worksheet based on a text file. I match the text file to the xlsx and write the 'Scores' column in the xlsx sheet and save the workbook. For those ... (43 Replies)
Discussion started by: nans
43 Replies

13. UNIX for Beginners Questions & Answers

Parsing a column of text file - best practices

HI Folks - I hope all is well! I have a business process where I manage a text file of substitution variables and their values for a target system. After updating, I run a script to push the changes to the target system. However, I'm trying to develop a method to be able to automatically... (50 Replies)
Discussion started by: SIMMS7400
50 Replies