Skip to content

Why does Quartiles::values() return [f32; 5] instead of [f64; 5]? #719

@your-diary

Description

@your-diary

Internally, each field of Quartiles struct is of the type f64:

pub struct Quartiles {
    lower_fence: f64,
    lower: f64,
    median: f64,
    upper: f64,
    upper_fence: f64,
}

But values() returns them after manually casting them to f32:

pub fn values(&self) -> [f32; 5] {
    [
        self.lower_fence as f32,
        self.lower as f32,
        self.median as f32,
        self.upper as f32,
        self.upper_fence as f32,
    ]
}

What is the design decision behind this?

related: #496 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions