Skip to content

floating point log methods do not round correctly #47273

Closed
@tspiteri

Description

@tspiteri

The methods f32::log and f64::log do not round correctly. As a trivial example, this code

fn main() {
    println!("{}, {}", 13f32.exp2().log2(), 13f32.exp2().log(2.0));
    println!("{}, {}", 29f64.exp2().log2(), 29f64.exp2().log(2.0));
}

outputs

13, 12.999999
29, 29.000000000000004

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and tools

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions