Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gendl
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
47
Issues
47
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
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
gendl
gendl
Commits
7a3a4a13
Commit
7a3a4a13
authored
Oct 12, 2018
by
Dave Cooper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
upgraded binary-search.
parent
71d5acb9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
4 deletions
+15
-4
base/rest/source/utilities.lisp
base/rest/source/utilities.lisp
+15
-4
No files found.
base/rest/source/utilities.lisp
View file @
7a3a4a13
...
@@ -953,12 +953,15 @@ toplevel inputs as specified in the snapshot file.
...
@@ -953,12 +953,15 @@ toplevel inputs as specified in the snapshot file.
(
min-max-search
function
comparison
mid
high
tolerance
verbose?
)))))
(
min-max-search
function
comparison
mid
high
tolerance
verbose?
)))))
(
defun
binary-search
(
function
value
low
high
&optional
(
tolerance
*zero-epsilon*
)
verbose?
)
(
defun
binary-search
(
function
value
low
high
&key
(
tolerance
*zero-epsilon*
)
(
search-granularity
*zero-epsilon*
)
verbose?
)
(
when
verbose?
(
print-variables
high
low
))
(
when
verbose?
(
print-variables
high
low
))
(
if
(
near-to?
high
low
tolerance
)
(
if
(
near-to?
high
low
search-granularity
)
(
progn
(
warn
"binary search did not converge, returning best guess"
)
(
progn
(
warn
"binary search did not converge, returning best guess"
)
high
)
high
)
(
let*
((
mid
(
half
(
+
low
high
)))
(
let*
((
mid
(
half
(
+
low
high
)))
...
@@ -967,8 +970,16 @@ toplevel inputs as specified in the snapshot file.
...
@@ -967,8 +970,16 @@ toplevel inputs as specified in the snapshot file.
(
print-variables
mid
mid-value
)
(
print-variables
mid
mid-value
)
(
cond
((
near-to?
mid-value
value
tolerance
)
mid
)
(
cond
((
near-to?
mid-value
value
tolerance
)
mid
)
((
>
mid-value
value
)
(
binary-search
function
value
low
mid
tolerance
verbose?
))
((
>
mid-value
value
)
(
binary-search
function
value
low
mid
((
<
mid-value
value
)
(
binary-search
function
value
mid
high
tolerance
verbose?
))))))
:tolerance
tolerance
:search-granularity
search-granularity
:verbose?
verbose?
))
((
<
mid-value
value
)
(
binary-search
function
value
mid
high
:tolerance
tolerance
:search-granularity
search-granularity
:verbose?
verbose?
))))))
...
...
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