Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pike
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pikelang
pike
Commits
d02226c4
Commit
d02226c4
authored
26 years ago
by
Per Hedbor
Browse files
Options
Downloads
Patches
Plain Diff
added atan2
Rev: src/modules/math/math.c:1.16
parent
89fb50df
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/modules/math/math.c
+12
-1
12 additions, 1 deletion
src/modules/math/math.c
with
12 additions
and
1 deletion
src/modules/math/math.c
+
12
−
1
View file @
d02226c4
...
...
@@ -24,7 +24,7 @@
#include
<floatingpoint.h>
#endif
RCSID
(
"$Id: math.c,v 1.1
5
1998/
08/07
1
6
:2
8:25 grubba
Exp $"
);
RCSID
(
"$Id: math.c,v 1.1
6
1998/
11/30
1
0
:2
7:44 per
Exp $"
);
#ifndef M_PI
#define M_PI 3.1415926535897932384626433832795080
...
...
@@ -113,6 +113,16 @@ void f_atan(INT32 args)
sp
[
-
args
].
u
.
float_number
=
atan
(
sp
[
-
args
].
u
.
float_number
);
}
void
f_atan2
(
INT32
args
)
{
if
(
args
<
2
)
error
(
"Too few arguments to atan2()
\n
"
);
if
(
sp
[
-
args
].
type
!=
T_FLOAT
)
error
(
"Bad argument 1 to atan2()
\n
"
);
if
(
sp
[
-
args
+
1
].
type
!=
T_FLOAT
)
error
(
"Bad argument 2 to atan2()
\n
"
);
sp
[
-
args
].
u
.
float_number
=
atan2
(
sp
[
-
args
].
u
.
float_number
,
sp
[
-
args
+
1
].
u
.
float_number
);
pop_stack
();
}
void
f_sqrt
(
INT32
args
)
{
if
(
args
<
1
)
error
(
"Too few arguments to sqrt()
\n
"
);
...
...
@@ -256,6 +266,7 @@ void pike_module_init(void)
add_efun
(
"acos"
,
f_acos
,
"function(float:float)"
,
0
);
add_efun
(
"tan"
,
f_tan
,
"function(float:float)"
,
0
);
add_efun
(
"atan"
,
f_atan
,
"function(float:float)"
,
0
);
add_efun
(
"atan2"
,
f_atan2
,
"function(float,float:float)"
,
0
);
add_efun
(
"sqrt"
,
f_sqrt
,
"function(float:float)|function(int:int)"
,
0
);
add_efun
(
"log"
,
f_log
,
"function(float:float)"
,
0
);
add_efun
(
"exp"
,
f_exp
,
"function(float:float)"
,
0
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment