diff options
author | Marius Kintel <marius@kintel.net> | 2012-01-08 18:14:30 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2012-01-08 18:14:30 (GMT) |
commit | 3c18145b13759db1a8926e29b81fb41f8efcde4d (patch) | |
tree | 75cc01dd8507a1667c4ba715cdc408ad785dce19 /src/func.cc | |
parent | 11fb1f71dad9c7d744ff5bbe7c3ee017ed67ff41 (diff) | |
parent | f3e6e8168bac6b14383d1d321de7dcf122e0b7de (diff) |
Merge branch 'master' into boost_filesystem
Diffstat (limited to 'src/func.cc')
-rw-r--r-- | src/func.cc | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/src/func.cc b/src/func.cc index 1138173..6686cb9 100644 --- a/src/func.cc +++ b/src/func.cc @@ -96,24 +96,14 @@ std::string BuiltinFunction::dump(const std::string &indent, const std::string & return dump.str(); } -static double deg2rad(double x) +static inline double deg2rad(double x) { - while (x < 0.0) - x += 360.0; - while (x >= 360.0) - x -= 360.0; - x = x * M_PI * 2.0 / 360.0; - return x; + return x * M_PI / 180.0; } -static double rad2deg(double x) +static inline double rad2deg(double x) { - x = x * 360.0 / (M_PI * 2.0); - while (x < 0.0) - x += 360.0; - while (x >= 360.0) - x -= 360.0; - return x; + return x * 180.0 / M_PI; } Value builtin_abs(const Context *, const std::vector<std::string>&, const std::vector<Value> &args) |