On Sunday, 27 April 2014 at 00:07:22 UTC, Adam D. Ruppe wrote:
On Sunday, 27 April 2014 at 00:01:21 UTC, Andrei Alexandrescu
wrote:
Oops. No bug. -- Andrei
Nah, sorry, that was my giant mistake, I didn't actually do the
math before saying check your math and let my brain get
confused into
this code: std.conv.parse!byte(-128) throws error: Overflow in
integral conversion. but this is obviously not true, as signed
byte can hold such value.
the question is: is it bug, or it's intended behavior to limit
signed integrals to values which can be safely abs()ed?
ketmar:
this code: std.conv.parse!byte(-128) throws error: Overflow
in integral conversion. but this is obviously not true, as
signed byte can hold such value.
the question is: is it bug, or it's intended behavior to limit
signed integrals to values which can be safely abs()ed?
This code
On Saturday, 26 April 2014 at 23:36:28 UTC, ketmar wrote:
this code: std.conv.parse!byte(-128) throws error: Overflow
in integral conversion. but this is obviously not true, as
signed byte can hold such value.
Check your math... the most negative number a signed byte can
hold is -127. The
On Saturday, 26 April 2014 at 23:43:11 UTC, Adam D. Ruppe wrote:
Check your math
sorry, i should check my own math. I got it backwards, you're
right.
On 04/27/2014 01:43 AM, Adam D. Ruppe wrote:
On Saturday, 26 April 2014 at 23:36:28 UTC, ketmar wrote:
this code: std.conv.parse!byte(-128) throws error: Overflow in
integral conversion. but this is obviously not true, as signed byte
can hold such value.
Check your math... the most negative
ah, sorry, this is my own fault, there is no bug in parser. what
i'm doing is parse!byte(128) and then negating the result.
silly me.
On 4/26/14, 4:43 PM, Adam D. Ruppe wrote:
On Saturday, 26 April 2014 at 23:36:28 UTC, ketmar wrote:
this code: std.conv.parse!byte(-128) throws error: Overflow in
integral conversion. but this is obviously not true, as signed byte
can hold such value.
Check your math... the most negative
On 4/26/14, 4:36 PM, ketmar wrote:
this code: std.conv.parse!byte(-128) throws error: Overflow in
integral conversion. but this is obviously not true, as signed byte can
hold such value.
the question is: is it bug, or it's intended behavior to limit signed
integrals to values which can be
On Sunday, 27 April 2014 at 00:01:21 UTC, Andrei Alexandrescu
wrote:
Oops. No bug. -- Andrei
Nah, sorry, that was my giant mistake, I didn't actually do the
math before saying check your math and let my brain get
confused into thinking 1000 was 128, but it is actually -128
in twos
On Sunday, 27 April 2014 at 00:04:15 UTC, ketmar wrote:
but this is definetely bug, i think:
void main() {
import std.stdio : writeln;
import std.conv : to;
writeln(to!int(29a, 16)); // 666
writeln(to!int(+29a, 16)); // Unexpected '+' when converting
from type string base 16 to type int
ah, i see: if (radix == 10) return parse!Target(s); in Target
parse(Target, Source)(ref Source s, uint radix)
it cheating a little and using 'general' decimal number parser,
which accepts '+' and '-'. for other bases it uses another code
though, where '+' and '-' threats as digits, which
12 matches
Mail list logo