/usr/share/shedskin/lib/math.hpp is in shedskin 0.9.4-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | /* Copyright 2005-2011 Mark Dufour and contributors; License Expat (See LICENSE) */
#ifndef __MATH_HPP
#define __MATH_HPP
#include "builtin.hpp"
using namespace __shedskin__;
namespace __math__ {
extern double pi;
extern double e;
void __init();
inline double ceil(double x) {
return std::ceil(x);
}
inline double fabs(double x) {
return std::fabs(x);
}
inline __ss_int factorial(__ss_int x) {
if (x < 0)
throw new ValueError(new str("factorial() not defined for negative values"));
__ss_int result = 1;
for (__ss_int i = 1; i <= x; ++i) {
result *= i;
}
return result;
}
inline double floor(double x) {
return std::floor(x);
}
inline double fmod(double x, double y) {
return std::fmod(x, y);
}
inline tuple2<double, double> *modf(double x) {
return (new tuple2<double, double>(2, x-(__ss_int)x, (double)(__ss_int)x));
}
inline double ldexp(double x, __ss_int i) {
return std::ldexp(x, i);
}
inline double exp(double x) {
return std::exp(x);
}
inline double log(double x) {
return std::log(x);
}
inline double log(double x, double base) {
return std::log(x) / std::log(base);
}
inline double log10(double x) {
return std::log10(x);
}
inline double sqrt(double x) {
return std::sqrt(x);
}
inline double acos(double x) {
return std::acos(x);
}
inline double asin(double x) {
return std::asin(x);
}
inline double atan(double x) {
return std::atan(x);
}
inline double atan2(double x, double y) {
return std::atan2(x, y);
}
inline double cos(double x) {
return std::cos(x);
}
inline double hypot(double x, double y) {
return sqrt(x*x+y*y);
}
inline double sin(double x) {
return std::sin(x);
}
inline double tan(double x) {
return std::tan(x);
}
inline double degrees(double x) {
return x*(180.0/pi);
}
inline double radians(double x) {
return x/(180.0/pi);
}
inline double cosh(double x) {
return std::cosh(x);
}
inline double sinh(double x) {
return std::sinh(x);
}
inline double tanh(double x) {
return std::tanh(x);
}
inline double pow(double x, double y) {
return std::pow(x,y);
}
} // module namespace
#endif
|