www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12547] New: floor/round/ceil that optionally return a specified integral type

https://d.puremagic.com/issues/show_bug.cgi?id=12547

           Summary: floor/round/ceil that optionally return a specified
                    integral type
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs eml.cc 2014-04-08 12:40:20 PDT ---
With a small counting I've seen that in my code I have often to cast the result
of the functions floor/round/ceil to integral values, like:

cast(ubyte)round(x)
cast(int)floor(y)

But I prefer to avoid casts in my code. So I suggest to modify them (or to add
new small functions) in Phobos that accept a template argument to specify the
result integer type:

round!ubyte(x)
floor!int(y)

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 08 2014