Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ToPrimitive for f64 -> f32 conversion. #180

Merged
merged 1 commit into from
Apr 15, 2016

Commits on Apr 15, 2016

  1. traits: Fix ToPrimitive for f64 -> f32 conversion.

    It should use the destination type and not the source type to check if
    the conversion would be to a value that's in range.
    
    NOTE: A finite f64 value that is larger than the f32 value range now produces
    None when converted to f32 with ToPrimitive.
    
    Previously, too large f64 values would produce inf f32 values. This `as`
    cast has an undefined result and was not specified to always produce for
    example `inf`.
    
    The conversion preserves nan/+-inf specifically.
    bluss committed Apr 15, 2016
    Configuration menu
    Copy the full SHA
    acde249 View commit details
    Browse the repository at this point in the history