Skip to content

".e".to_f returns NAN #6183

Description

@dearblue
% bin/mirb
mirb - Embeddable Interactive Ruby Shell

> ".e".to_f
 => NaN
> ".f".to_f
 => 0.0
> ".g".to_f
 => 0.0

CRuby 3.3 will all be converted to 0.0.

% irb33
irb(main):001> ".e".to_f
=> 0.0
irb(main):002> ".f".to_f
=> 0.0
irb(main):003> ".g".to_f
=> 0.0

Not sure if this is the cause, but passing ".e" to mrb_read_float() returns 0.1.

For reference, the original, https://github.com/mattn/strtod, returns 0.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions