Bug 4445 – roundTo!ubyte(255.0) throws

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2010-07-10T12:19:00Z
Last change time
2010-11-16T12:57:37Z
Assigned to
rsinfu
Creator
dsimcha

Comments

Comment #0 by dsimcha — 2010-07-10T12:19:58Z
Seems like an off-by-one error in checking the bounds. import std.stdio, std.conv; void main() { auto foo = cast(ubyte) roundTo!uint(255.0); writeln(foo); // 255: Works. auto bar = roundTo!ubyte(254.0); writeln(bar); // 254: Works. auto baz = roundTo!ubyte(255.0); // Throws }
Comment #1 by rsinfu — 2010-11-16T12:57:37Z