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
Hide 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"
#include "func_ptr.h"
double
bisec
(
func_ptr
f
,
double
left
,
double
right
,
double
epsilon
,
unsigned
int
*
steps
)
{
double
bisec
(
func_ptr
f
,
double
left
,
double
right
,
int
i
;
double
epsilon
,
unsigned
int
*
steps
)
{
double
mid
;
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
;
mid
=
(
right
+
left
)
/
2
;
if
(
f
(
left
)
*
f
(
mid
)
<
0
)
if
(
f
(
left
)
*
(
fmid
=
f
(
mid
)
)
<
0
)
right
=
mid
;
right
=
mid
;
else
if
(
f
(
right
)
*
f
(
mid
)
<
0
)
else
if
(
f
(
right
)
*
f
mid
<
0
)
left
=
mid
;
left
=
mid
;
else
else
break
;
break
;
}
}
*
steps
=
i
;
return
mid
;
return
mid
;
}
}
modsim/ass2/regula_falsi.h
View file @
14aeba10
...
@@ -2,14 +2,14 @@
...
@@ -2,14 +2,14 @@
#include "func_ptr.h"
#include "func_ptr.h"
double
regula_falsi
(
func_ptr
f
,
double
s
,
double
t
,
double
e
,
double
regula_falsi
(
func_ptr
f
,
double
s
,
double
t
,
double
e
,
int
*
steps
,
unsigned
int
m
)
{
unsigned
int
*
steps
,
unsigned
int
m
)
{
int
n
,
side
=
0
;
int
side
=
0
;
double
r
,
fr
,
fs
=
f
(
s
),
ft
=
f
(
t
);
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
);
r
=
(
fs
*
t
-
ft
*
s
)
/
(
fs
-
ft
);
if
(
fabs
(
t
-
s
)
<
e
*
fabs
(
t
+
s
)
)
if
(
fabs
(
t
-
s
)
<
e
*
fabs
(
t
+
s
)
)
break
;
break
;
fr
=
f
(
r
);
fr
=
f
(
r
);
...
@@ -34,8 +34,6 @@ double regula_falsi(func_ptr f, double s, double t, double e,
...
@@ -34,8 +34,6 @@ double regula_falsi(func_ptr f, double s, double t, double e,
break
;
break
;
}
}
*
steps
=
n
;
return
r
;
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