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
514cafe6
Commit
514cafe6
authored
Mar 28, 2014
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
do not use "to_f" to retrieve floats in mrb_get_args(); close #1965
parent
b8e434a5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
20 deletions
+3
-20
include/mruby/numeric.h
include/mruby/numeric.h
+1
-0
src/class.c
src/class.c
+1
-19
src/numeric.c
src/numeric.c
+1
-1
No files found.
include/mruby/numeric.h
View file @
514cafe6
...
...
@@ -23,6 +23,7 @@ mrb_value mrb_fixnum_plus(mrb_state *mrb, mrb_value x, mrb_value y);
mrb_value
mrb_fixnum_minus
(
mrb_state
*
mrb
,
mrb_value
x
,
mrb_value
y
);
mrb_value
mrb_fixnum_mul
(
mrb_state
*
mrb
,
mrb_value
x
,
mrb_value
y
);
mrb_value
mrb_num_div
(
mrb_state
*
mrb
,
mrb_value
x
,
mrb_value
y
);
mrb_float
mrb_to_flo
(
mrb_state
*
mrb
,
mrb_value
x
);
#if defined(__cplusplus)
}
/* extern "C" { */
...
...
src/class.c
View file @
514cafe6
...
...
@@ -568,25 +568,7 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
p
=
va_arg
(
ap
,
mrb_float
*
);
if
(
i
<
argc
)
{
switch
(
mrb_type
(
*
sp
))
{
case
MRB_TT_FLOAT
:
*
p
=
mrb_float
(
*
sp
);
break
;
case
MRB_TT_FIXNUM
:
*
p
=
(
mrb_float
)
mrb_fixnum
(
*
sp
);
break
;
case
MRB_TT_STRING
:
mrb_raise
(
mrb
,
E_TYPE_ERROR
,
"no implicit conversion of String into Float"
);
break
;
default:
{
mrb_value
tmp
;
tmp
=
mrb_convert_type
(
mrb
,
*
sp
,
MRB_TT_FLOAT
,
"Float"
,
"to_f"
);
*
p
=
mrb_float
(
tmp
);
}
break
;
}
*
p
=
mrb_to_flo
(
mrb
,
*
sp
);
sp
++
;
i
++
;
}
...
...
src/numeric.c
View file @
514cafe6
...
...
@@ -27,7 +27,7 @@
#define FLO_EPSILON DBL_EPSILON
#endif
static
mrb_float
mrb_float
mrb_to_flo
(
mrb_state
*
mrb
,
mrb_value
val
)
{
switch
(
mrb_type
(
val
))
{
...
...
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