1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Make new object for negated float as Float is always frozen now

This commit is contained in:
Nobuyoshi Nakada 2021-10-26 20:12:15 +09:00
parent 37395ffa05
commit e1ecda297e
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6

View file

@ -11924,7 +11924,7 @@ negate_lit(struct parser_params *p, VALUE lit)
RCOMPLEX_SET_IMAG(lit, negate_lit(p, RCOMPLEX(lit)->imag));
break;
case T_FLOAT:
RFLOAT(lit)->float_value = -RFLOAT_VALUE(lit);
lit = DBL2NUM(-RFLOAT_VALUE(lit));
break;
unknown:
default: