Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
uva
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
uva
Commits
14aeba10
Commit
14aeba10
authored
Feb 28, 2011
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed unsigned integer comparison problem.
parent
0c91e4d7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
14 deletions
+10
-14
modsim/ass2/bisec.h
modsim/ass2/bisec.h
+6
-8
modsim/ass2/regula_falsi.h
modsim/ass2/regula_falsi.h
+4
-6
No files found.
modsim/ass2/bisec.h
View file @
14aeba10
#include "func_ptr.h"
double
bisec
(
func_ptr
f
,
double
left
,
double
right
,
double
epsilon
,
unsigned
int
*
steps
)
{
int
i
;
double
mid
;
double
bisec
(
func_ptr
f
,
double
left
,
double
right
,
double
epsilon
,
unsigned
int
*
steps
)
{
double
mid
,
fmid
;
for
(
i
=
1
;
fabs
(
right
-
left
)
>
2
*
epsilon
;
i
++
)
{
for
(
*
steps
=
0
;
fabs
(
right
-
left
)
>
2
*
epsilon
;
(
*
steps
)
++
)
{
mid
=
(
right
+
left
)
/
2
;
if
(
f
(
left
)
*
f
(
mid
)
<
0
)
if
(
f
(
left
)
*
(
fmid
=
f
(
mid
)
)
<
0
)
right
=
mid
;
else
if
(
f
(
right
)
*
f
(
mid
)
<
0
)
else
if
(
f
(
right
)
*
f
mid
<
0
)
left
=
mid
;
else
break
;
}
*
steps
=
i
;
return
mid
;
}
modsim/ass2/regula_falsi.h
View file @
14aeba10
...
...
@@ -2,14 +2,14 @@
#include "func_ptr.h"
double
regula_falsi
(
func_ptr
f
,
double
s
,
double
t
,
double
e
,
int
*
steps
,
unsigned
int
m
)
{
int
n
,
side
=
0
;
unsigned
int
*
steps
,
unsigned
int
m
)
{
int
side
=
0
;
double
r
,
fr
,
fs
=
f
(
s
),
ft
=
f
(
t
);
for
(
n
=
0
;
n
<
m
;
n
++
)
{
for
(
*
steps
=
0
;
*
steps
<
m
;
(
*
steps
)
++
)
{
r
=
(
fs
*
t
-
ft
*
s
)
/
(
fs
-
ft
);
if
(
fabs
(
t
-
s
)
<
e
*
fabs
(
t
+
s
)
)
if
(
fabs
(
t
-
s
)
<
e
*
fabs
(
t
+
s
)
)
break
;
fr
=
f
(
r
);
...
...
@@ -34,8 +34,6 @@ double regula_falsi(func_ptr f, double s, double t, double e,
break
;
}
*
steps
=
n
;
return
r
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment