Skip to content

Float v.s float #1669

Closed
Closed

Description

@wschin

In ML.NET codebase, one can see two different names for 32-bit float type. Recent PR uses float while old places have Float. It'd be nice to have only one of the two styles.

Activity

  1. tannergooding commented on Nov 19, 2018

    @tannergooding
    Member

    The .NET Design guidelines indicate we should use the language keyword (float) everywhere except for API names, where we should use the non-language specific name (Single):

    For example:

    public static class BitConverter
    {
        public static float Int32BitsToSingle(int bits);
        public static int SingleToInt32Bits(float value);
    }

    CC. @eerhardt

  2. Ivanidzo4ka commented on Nov 19, 2018

    @Ivanidzo4ka
    Contributor

    @wschin we are trying to get rid of Float in our code, and if you look into estimators PRs we almost always delete that using Float = System.Single; line and use float instead

  3. TomFinley commented on Nov 19, 2018

    @TomFinley
    Contributor

    Just some history, in the long vanished past we used to have two builds, a "double" and a "single" build. (This was in the days before IDataView where pipelines could accommodate either.) But, when we removed the compiler switch, it was beneficial to keep the declaration around: by doing so you only had a couple thousand lines changed, instead of tens of thousands of lines changed.

    We've been opportunistically removing Float though, though in a very very piecemeal fashion. Doing it all at once though -- well, it might be a good idea, but that would be one heck of a PR to manage conflicts on. 😛

  4. Zruty0 commented on Nov 20, 2018

    @Zruty0
    Contributor

    Yes, just recently I saw someone mass-renaming Single to float, and ending up with Ldafloatbox somewhere in comments :)

  5. glebuk commented on Jan 14, 2019

    @glebuk
    Contributor

    Seems to be fixed already

  6. Ivanidzo4ka commented on Jan 14, 2019

    @Ivanidzo4ka
    Contributor

    Not exactly finished.


    We have still plenty of places where we have using Float = System.Single; pattern.

    In many places we clean it up via different unrelated PRs, but some code haven't been touch since we merge it from internal repo.

  7. reopened this on Feb 6, 2019
  8. sfilipi commented on Feb 6, 2019

    @sfilipi
    Member

    The action item on this PR is to remove

    using Float = System.Single from all the files, and through the codebase, replace Float, with float.

  9. added this to the 0219 milestone on Feb 28, 2019
  10. ghost locked as resolved and limited conversation to collaborators on Mar 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions