Skip to content

Inconsistency of float parsing #9418

@Akirathan

Description

@Akirathan

There is an inconsistency between text.parse_float and column.parse Value_Type.Float. The former handles exponential notation by default, whereas the latter does not.

from Standard.Base import all
from Standard.Table import all

main =
    float_text = "6.861455777981732e-05"
    col = Column.from_vector "col" [float_text]
    parsed_1 = col.parse Value_Type.Float . first
    parsed_2 = col.map (x-> x.parse_float) . first
    IO.println <| "parsed_1 = " + parsed_1.to_text
    IO.println <| "parsed_2 = " + parsed_2.to_text
    parsed_1 == parsed_2

Outputs:

parsed_1 = Nothing
parsed_2 = 6.861455777981732E-5
false

According to @radeusgd, the Data_Formatter.allow_exponential_notation:Boolean should be set to True by default.

Metadata

Metadata

Assignees

Labels

-libsLibraries: New libraries to be implemented

Type

No type

Projects

Status

📤 Backlog

Relationships

None yet

Development

No branches or pull requests

Issue actions