www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9742] New: std.math.floor returns 0 for any value x > -1 and x < 0

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9742

           Summary: std.math.floor returns 0 for any value x > -1 and x <
                    0
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: code benjamin-thaut.de



PDT ---
The documentation says that std.math.floor

Returns the value of x rounded downward to the next integer (toward negative
infinity).

But it returns 0 for any value x > -1 and x < 0. This used to work correctly in
earlier versions of phobos.

Repro case:

import std.math;
import core.stdc.stdio;

void main(string[] args)
{
    assert(std.math.floor(-0.002f) == -1.0f);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 17 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9742




Using current git DMD and Phobos, works for me on D2 Linux with both 32 bit and
64bit, with and without -O.
Perhaps this is OS-specific. Can you give more details?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 22 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9742




PDT ---
Yes happend to me on Windows, might be platform specific.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 08 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9742


Tiberiu Gal <galtiberiu gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |galtiberiu gmail.com



---
it works on windows

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 26 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9742


Andrei Alexandrescu <andrei erdani.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrei erdani.com



PDT ---
Can Tiberiu or somebody else confirm this works on Win32/64 with the latest
beta? Thanks!

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 27 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9742




---
I can only test it with win32. It works with the latest beta. 
(OT: Is there any easy way to test win64?)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 27 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9742


Mike Wey <mike-wey planet.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mike-wey planet.nl



It works for me under Windows with the latest beta.

Both the 32 and 64 bits version are working.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 27 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9742


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bearophile_hugs eml.cc
         Resolution|                            |WORKSFORME




 It works for me under Windows with the latest beta.
 
 Both the 32 and 64 bits version are working.
I have only tried it on 32 bit. If you have tried it on 64 bit, then let's close this down. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 27 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9742


Nick Sabalausky <cbkbbejeap mailinator.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |cbkbbejeap mailinator.com
         Resolution|WORKSFORME                  |FIXED



12:42:25 PDT ---
It works for me on Win32 with both 2.062 and the latest beta, when using no
cmdline switches, and also when using "-O -inline -noboundscheck".

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 27 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9742




PDT ---
Great, thanks everyone for chiming in!

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 27 2013