Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
72ed7eeb
Commit
72ed7eeb
authored
8 years ago
by
Tomasz Dąbrowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed Range.size to use proper floating point tolerance
parent
a8b8abbd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletion
+8
-1
include/mruby.h
include/mruby.h
+7
-0
mrbgems/mruby-range-ext/src/range.c
mrbgems/mruby-range-ext/src/range.c
+1
-1
No files found.
include/mruby.h
View file @
72ed7eeb
...
...
@@ -64,6 +64,13 @@
#endif
#include "mrbconf.h"
#ifdef MRB_USE_FLOAT
#define MRB_FLOAT_EPSILON FLT_EPSILON
#else
#define MRB_FLOAT_EPSILON DBL_EPSILON
#endif
#include "mruby/common.h"
#include <mruby/value.h>
#include <mruby/gc.h>
...
...
This diff is collapsed.
Click to expand it.
mrbgems/mruby-range-ext/src/range.c
View file @
72ed7eeb
...
...
@@ -140,7 +140,7 @@ mrb_range_size(mrb_state *mrb, mrb_value range)
}
if
(
num_p
)
{
mrb_float
n
=
end_f
-
beg_f
;
mrb_float
err
=
(
fabs
(
beg_f
)
+
fabs
(
end_f
)
+
fabs
(
end_f
-
beg_f
))
*
DBL
_EPSILON
;
mrb_float
err
=
(
fabs
(
beg_f
)
+
fabs
(
end_f
)
+
fabs
(
end_f
-
beg_f
))
*
MRB_FLOAT
_EPSILON
;
if
(
err
>
0
.
5
)
err
=
0
.
5
;
if
(
excl
)
{
...
...
This diff is collapsed.
Click to expand it.
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