~ubuntu-branches/ubuntu/utopic/9base/utopic

« back to all changes in this revision

Viewing changes to hoc/math.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2009-11-07 12:25:14 UTC
  • mfrom: (6.2.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091107122514-tcw4u4ha2w2xbbnn
* Adding maintainer homepage field to control.
* Marking maintainer homepage field to be also included in binary
  packages and changelog.
* Adding README.source.
* Merging upstream version 4.
* Adding sh4 to explicit architecture list (Closes: #545772).
* Moving maintainer homepage field from control to copyright.
* Updating README.source.
* Updating homepage field in control.
* Removing manpage patch, went upstream.
* Removing kfreebsd.patch, went upstream.
* Generalizing manpage moving in rules.
* Moving base directory from /usr/lib/9base to /usr/lib/plan9 for
  consistency reasons.
* Prefixing manpages with plan9 instead of 9base for consistency
  reasons.
* Bumping versioned build-depends on debhelper.
* Making internal mkMAP and sendcover scripts executable.
* Adding patch to adjust shebang in newly included troff commands.
* Updating lintian-overrides.
* Making buildd-depends on quilt versioned.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <u.h>
 
2
#include <libc.h>
 
3
 
 
4
#include "hoc.h"
 
5
 
 
6
double  errcheck(double, char*);
 
7
 
 
8
double
 
9
Log(double x)
 
10
{
 
11
        return errcheck(log(x), "log");
 
12
}
 
13
double
 
14
Log10(double x)
 
15
{
 
16
        return errcheck(log10(x), "log10");
 
17
}
 
18
 
 
19
double
 
20
Sqrt(double x)
 
21
{
 
22
        return errcheck(sqrt(x), "sqrt");
 
23
}
 
24
 
 
25
double
 
26
Exp(double x)
 
27
{
 
28
        return errcheck(exp(x), "exp");
 
29
}
 
30
 
 
31
double
 
32
Asin(double x)
 
33
{
 
34
        return errcheck(asin(x), "asin");
 
35
}
 
36
 
 
37
double
 
38
Acos(double x)
 
39
{
 
40
        return errcheck(acos(x), "acos");
 
41
}
 
42
 
 
43
double
 
44
Sinh(double x)
 
45
{
 
46
        return errcheck(sinh(x), "sinh");
 
47
}
 
48
double
 
49
Cosh(double x)
 
50
{
 
51
        return errcheck(cosh(x), "cosh");
 
52
}
 
53
double
 
54
Pow(double x, double y)
 
55
{
 
56
        return errcheck(pow(x,y), "exponentiation");
 
57
}
 
58
 
 
59
double
 
60
integer(double x)
 
61
{
 
62
        if(x<-2147483648.0 || x>2147483647.0)
 
63
                execerror("argument out of domain", 0);
 
64
        return (double)(long)x;
 
65
}
 
66
 
 
67
double
 
68
errcheck(double d, char* s)     /* check result of library call */
 
69
{
 
70
        if(isNaN(d))
 
71
                execerror(s, "argument out of domain");
 
72
        if(isInf(d, 0))
 
73
                execerror(s, "result out of range");
 
74
        return d;
 
75
}