Skip to content

Commit

Permalink
[PRISM] Fix float in case dispatch
Browse files Browse the repository at this point in the history
  • Loading branch information
kddnewton committed Mar 15, 2024
1 parent 3fcab3c commit 1e7c0fc
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion prism_compile.c
Expand Up @@ -4167,8 +4167,17 @@ pm_compile_case_node_dispatch(VALUE dispatch, const pm_node_t *node, LABEL *labe
VALUE key = Qundef;

switch (PM_NODE_TYPE(node)) {
case PM_FLOAT_NODE: {
key = pm_static_literal_value(node, scope_node);
double intptr;

if (modf(RFLOAT_VALUE(key), &intptr) == 0.0) {
key = (FIXABLE(intptr) ? LONG2FIX((long) intptr) : rb_dbl2big(intptr));
}

break;
}
case PM_FALSE_NODE:
case PM_FLOAT_NODE:
case PM_INTEGER_NODE:
case PM_NIL_NODE:
case PM_SOURCE_FILE_NODE:
Expand Down

0 comments on commit 1e7c0fc

Please sign in to comment.