Re: ow Integers Should Work

2011-12-08 Thread bcs
On 12/08/2011 04:15 AM, Don wrote: On 08.12.2011 05:46, bcs wrote: On 12/06/2011 11:50 PM, Don wrote: He's talking about system languages. A system language has to have a close relationship to the architecture. By contrast, if you don't care about performance, it's easy -- just use BigInts fo

Re: ow Integers Should Work

2011-12-08 Thread Andrei Alexandrescu
On 12/8/11 4:47 AM, Don wrote: The Loitsch paper is very interesting, it presents a simple very fast method which works in 99.5% of cases. Then, you fall back to the simple slow method for the remaining 0.5%. The slow case is rare enough that it's not worth optimizing it. I think a D implementa

Re: ow Integers Should Work

2011-12-08 Thread Don
On 08.12.2011 05:46, bcs wrote: On 12/06/2011 11:50 PM, Don wrote: He's talking about system languages. A system language has to have a close relationship to the architecture. By contrast, if you don't care about performance, it's easy -- just use BigInts for everything. Problem solved. Looks

Re: ow Integers Should Work

2011-12-08 Thread Don
On 06.12.2011 08:20, Walter Bright wrote: On 12/5/2011 10:52 PM, Don wrote: On 06.12.2011 05:15, Walter Bright wrote: On 12/5/2011 8:10 PM, bearophile wrote: This is not about integers but yeah, I'd like the better str<-> float conversions of Python in D too. Do you have any test data that t

Re: ow Integers Should Work

2011-12-07 Thread bcs
On 12/06/2011 11:50 PM, Don wrote: He's talking about system languages. A system language has to have a close relationship to the architecture. By contrast, if you don't care about performance, it's easy -- just use BigInts for everything. Problem solved. Looks like I have to put it more blunt

Re: ow Integers Should Work

2011-12-07 Thread Walter Bright
On 12/7/2011 2:46 AM, bearophile wrote: Today some online games are managing real money of the players. You don't want to use raw integers to manage those important numbers :-) Banks have been using computer programs to handle money forever, so has every piece of accounting software. I.e. it's

Re: ow Integers Should Work

2011-12-07 Thread Timon Gehr
On 12/07/2011 11:41 AM, bearophile wrote: [...] As it usually happens in complex systems, there are far more ways for that system to not work than to work. [...] Maybe we should exclusively study the ways for for the system to work, as that seems to be less complex.

Re: ow Integers Should Work

2011-12-07 Thread Timon Gehr
On 12/07/2011 11:46 AM, bearophile wrote: Manu: but making standard ints compromise basic hardware implementation just won't fly.< Ada language does those things, and it's used to fly planes :-) So maybe it will fly. Maybe. Ada in action: http://www.youtube.com/watch?v=kYUrqdUyEpI Toda

Re: ow Integers Should Work

2011-12-07 Thread bearophile
Manu: > but making standard ints compromise basic hardware implementation just won't > fly.< Ada language does those things, and it's used to fly planes :-) So maybe it will fly. Today some online games are managing real money of the players. You don't want to use raw integers to manage those

Re: ow Integers Should Work

2011-12-07 Thread bearophile
Kagamin: >I played a game, where experience counter was int32, it wasn't meant to >overflow during normal play, but it allowed console commands, which could be a >lot of fun, so I made xp overflow to negative values, it didn't make any >trouble, just in the case it used checked arithmetic, it w

Re: ow Integers Should Work

2011-12-07 Thread Paulo Pinto
Don Wrote: > On 07.12.2011 05:11, bcs wrote: > > On 12/05/2011 11:20 PM, Don wrote: > >> On 06.12.2011 05:21, bcs wrote: > >>> On 12/05/2011 08:37 AM, Don wrote: > On 05.12.2011 14:31, bearophile wrote: > > Found through Reddit, two blog posts about how integers should behave > > in s

Re: ow Integers Should Work

2011-12-07 Thread Kagamin
On 2011-Dec-05 18:30:54+00:00, bearophile wrote: Manu: but I don't believe I'm alone.. the rest of the gamedev community will find D soon enough if the language gets it right... I think games are one of the most important short-term purposes of D, despite I think D was not explicitly designed

Re: ow Integers Should Work

2011-12-06 Thread Don
On 07.12.2011 05:11, bcs wrote: On 12/05/2011 11:20 PM, Don wrote: On 06.12.2011 05:21, bcs wrote: On 12/05/2011 08:37 AM, Don wrote: On 05.12.2011 14:31, bearophile wrote: Found through Reddit, two blog posts about how integers should behave in system languages (with hardware support): http

Re: ow Integers Should Work

2011-12-06 Thread bcs
On 12/05/2011 11:20 PM, Don wrote: On 06.12.2011 05:21, bcs wrote: On 12/05/2011 08:37 AM, Don wrote: On 05.12.2011 14:31, bearophile wrote: Found through Reddit, two blog posts about how integers should behave in system languages (with hardware support): http://blog.regehr.org/archives/641 h

Re: ow Integers Should Work

2011-12-06 Thread bcs
On 12/06/2011 09:49 AM, Walter Bright wrote: On 12/6/2011 9:14 AM, Andrei Alexandrescu wrote: Translating dtoa.c to D and making sure it works during compilation sounds like a great project. People who want to help D in any way, please take notice :o). Sadly, despite dtoa.c's wide use, there d

Re: ow Integers Should Work

2011-12-06 Thread Derek
On Wed, 07 Dec 2011 04:11:40 +1100, Andrei Alexandrescu wrote: On 12/6/11 1:16 AM, Walter Bright wrote: On 12/5/2011 8:48 PM, Andrei Alexandrescu wrote: On 12/5/11 10:15 PM, Walter Bright wrote: On 12/5/2011 8:10 PM, bearophile wrote: This is not about integers but yeah, I'd like the bett

Re: ow Integers Should Work

2011-12-06 Thread David Nadlinger
On 12/6/11 6:14 PM, Andrei Alexandrescu wrote: On 12/6/11 1:20 AM, Walter Bright wrote: (Python's implementation currently uses David Gay's dtoa.c) Translating dtoa.c to D and making sure it works during compilation sounds like a great project. People who want to help D in any way, please take

Re: ow Integers Should Work

2011-12-06 Thread Walter Bright
On 12/6/2011 9:11 AM, Andrei Alexandrescu wrote: On 12/6/11 1:16 AM, Walter Bright wrote: On 12/5/2011 8:48 PM, Andrei Alexandrescu wrote: On 12/5/11 10:15 PM, Walter Bright wrote: Darn, licensing problems: "Redistributions in binary form must reproduce the above copyright notice, this list o

Re: ow Integers Should Work

2011-12-06 Thread Walter Bright
On 12/6/2011 9:14 AM, Andrei Alexandrescu wrote: Translating dtoa.c to D and making sure it works during compilation sounds like a great project. People who want to help D in any way, please take notice :o). Sadly, despite dtoa.c's wide use, there doesn't appear to be a test suite for it. I su

Re: ow Integers Should Work

2011-12-06 Thread Andrei Alexandrescu
On 12/6/11 1:16 AM, Walter Bright wrote: On 12/5/2011 8:48 PM, Andrei Alexandrescu wrote: On 12/5/11 10:15 PM, Walter Bright wrote: On 12/5/2011 8:10 PM, bearophile wrote: This is not about integers but yeah, I'd like the better str<-> float conversions of Python in D too. Do you have any te

Re: ow Integers Should Work

2011-12-06 Thread Andrei Alexandrescu
On 12/6/11 1:20 AM, Walter Bright wrote: On 12/5/2011 10:52 PM, Don wrote: On 06.12.2011 05:15, Walter Bright wrote: On 12/5/2011 8:10 PM, bearophile wrote: This is not about integers but yeah, I'd like the better str<-> float conversions of Python in D too. Do you have any test data that th

Re: ow Integers Should Work

2011-12-06 Thread Manu
Cheers, I'll do that! I've still had nothing but trouble getting cygwin to build the mips toolchain we were experimenting with. I don't know enough about GCC and making it work >_<. Although ideally a binary distribution would probably want to be mingw/msys based. On 6 December 2011 14:23, Iain Bu

Re: ow Integers Should Work

2011-12-06 Thread Iain Buclaw
On 6 December 2011 10:27, Manu wrote: >> Manu: >> >> > but I don't believe I'm alone.. the rest >> > of the gamedev community will find D soon enough if the language gets it >> > right... >> >> I think games are one of the most important short-term purposes of D, >> despite I think D was not expli

Re: ow Integers Should Work

2011-12-06 Thread Manu
> > Manu: > > > but I don't believe I'm alone.. the rest > > of the gamedev community will find D soon enough if the language gets it > > right... > > I think games are one of the most important short-term purposes of D, > despite I think D was not explicitly designed to write games. > I agree, it

Re: ow Integers Should Work

2011-12-05 Thread Don
On 06.12.2011 05:21, bcs wrote: On 12/05/2011 08:37 AM, Don wrote: On 05.12.2011 14:31, bearophile wrote: Found through Reddit, two blog posts about how integers should behave in system languages (with hardware support): http://blog.regehr.org/archives/641 http://blog.regehr.org/archives/642

Re: ow Integers Should Work

2011-12-05 Thread Walter Bright
On 12/5/2011 10:52 PM, Don wrote: On 06.12.2011 05:15, Walter Bright wrote: On 12/5/2011 8:10 PM, bearophile wrote: This is not about integers but yeah, I'd like the better str<-> float conversions of Python in D too. Do you have any test data that they actually are better in Python (apart fr

Re: ow Integers Should Work

2011-12-05 Thread Walter Bright
On 12/5/2011 8:48 PM, Andrei Alexandrescu wrote: On 12/5/11 10:15 PM, Walter Bright wrote: On 12/5/2011 8:10 PM, bearophile wrote: This is not about integers but yeah, I'd like the better str<-> float conversions of Python in D too. Do you have any test data that they actually are better in P

Re: ow Integers Should Work

2011-12-05 Thread Walter Bright
On 12/5/2011 8:48 PM, Andrei Alexandrescu wrote: On 12/5/11 10:15 PM, Walter Bright wrote: On 12/5/2011 8:10 PM, bearophile wrote: This is not about integers but yeah, I'd like the better str<-> float conversions of Python in D too. Do you have any test data that they actually are better in P

Re: ow Integers Should Work

2011-12-05 Thread Don
On 06.12.2011 05:15, Walter Bright wrote: On 12/5/2011 8:10 PM, bearophile wrote: This is not about integers but yeah, I'd like the better str<-> float conversions of Python in D too. Do you have any test data that they actually are better in Python (apart from just being better specified)?

Re: ow Integers Should Work

2011-12-05 Thread Andrei Alexandrescu
On 12/5/11 9:57 PM, Walter Bright wrote: http://www.cs.washington.edu/education/courses/cse590p/590k_02au/print-fp.pdf http://www.cs.washington.edu/education/courses/cse590p/590k_02au/read-fp.pdf In fact there's more recent work on that, see http://goo.gl/H6VZD. It's been on reddit, too: http

Re: ow Integers Should Work

2011-12-05 Thread Andrei Alexandrescu
On 12/5/11 10:15 PM, Walter Bright wrote: On 12/5/2011 8:10 PM, bearophile wrote: This is not about integers but yeah, I'd like the better str<-> float conversions of Python in D too. Do you have any test data that they actually are better in Python (apart from just being better specified)?

Re: ow Integers Should Work

2011-12-05 Thread bcs
On 12/05/2011 01:37 PM, Don wrote: On 05.12.2011 18:36, bearophile wrote: Manu: Also, contrary to his claim, I find that wrapping is usually what I DO want in this case.. It's super rare that I write any code that pushes the limits of an int (unless we're talking 8-16 bit, see my range+saturat

Re: ow Integers Should Work

2011-12-05 Thread bcs
On 12/05/2011 08:37 AM, Don wrote: On 05.12.2011 14:31, bearophile wrote: Found through Reddit, two blog posts about how integers should behave in system languages (with hardware support): http://blog.regehr.org/archives/641 http://blog.regehr.org/archives/642 Bye, bearophile Not very convin

Re: ow Integers Should Work

2011-12-05 Thread Walter Bright
On 12/5/2011 8:10 PM, bearophile wrote: This is not about integers but yeah, I'd like the better str<-> float conversions of Python in D too. Do you have any test data that they actually are better in Python (apart from just being better specified)?

Re: ow Integers Should Work

2011-12-05 Thread bearophile
Walter: > there's something else in Python 3 > That I'd love to have in C++, namely a guarantee that: This is not about integers but yeah, I'd like the better str <-> float conversions of Python in D too. Bye, bearophile

Re: ow Integers Should Work

2011-12-05 Thread bcs
On 12/05/2011 05:31 AM, bearophile wrote: Found through Reddit, two blog posts about how integers should behave in system languages (with hardware support): http://blog.regehr.org/archives/641 http://blog.regehr.org/archives/642 I've been following that guy for a while now. He's doing some RE

Re: ow Integers Should Work

2011-12-05 Thread Walter Bright
On 12/5/2011 1:37 PM, Don wrote: The "overflow12.pdf" paper on that site shows statistics that overflow is very often intentional. It's strong evidence that you *cannot* make signed overflow an error. Even if you could do it with zero complexity and zero performance impact, it would be wrong. H

Re: ow Integers Should Work

2011-12-05 Thread bearophile
Don: > The "overflow12.pdf" paper on that site shows statistics that overflow > is very often intentional. This is expected, the C/C++ programmers are using the semantics of their language. But it's just because they are using a language with a bad integer semantics. A better designed language

Re: ow Integers Should Work

2011-12-05 Thread bearophile
Don: > The "overflow12.pdf" paper on that site shows statistics that overflow > is very often intentional. In C/C++ code, but we are developing D, a new language that hopes to fix some of the mistakes of languages invented lot of time ago. > It's strong evidence that you *cannot* make signed

Re: ow Integers Should Work

2011-12-05 Thread Don
On 05.12.2011 18:36, bearophile wrote: Manu: Also, contrary to his claim, I find that wrapping is usually what I DO want in this case.. It's super rare that I write any code that pushes the limits of an int (unless we're talking 8-16 bit, see my range+saturation comment before), and when I do w

Re: ow Integers Should Work

2011-12-05 Thread Alex Rønne Petersen
On 05-12-2011 20:34, Paulo Pinto wrote: Am 05.12.2011 19:04, schrieb Manu: Manu: > Also, contrary to his claim, I find that wrapping is usually what I > DO want in this case.. > It's super rare that I write any code that pushes the limits of an int > (unless we're talking 8-16 bit, see my range

Re: ow Integers Should Work

2011-12-05 Thread Paulo Pinto
Am 05.12.2011 19:04, schrieb Manu: Manu: > Also, contrary to his claim, I find that wrapping is usually what I > DO want in this case.. > It's super rare that I write any code that pushes the limits of an int > (unless we're talking 8-16 bit, see my range+saturation c

Re: ow Integers Should Work

2011-12-05 Thread Walter Bright
On 12/5/2011 5:31 AM, bearophile wrote: Found through Reddit, two blog posts about how integers should behave in system languages (with hardware support): http://blog.regehr.org/archives/641 http://blog.regehr.org/archives/642 Bye, bearophile Lotsa good comments on HN: http://news.ycombinato

Re: ow Integers Should Work

2011-12-05 Thread bearophile
Manu: > but I don't believe I'm alone.. the rest > of the gamedev community will find D soon enough if the language gets it > right... I think games are one of the most important short-term purposes of D, despite I think D was not explicitly designed to write games. > If you're suggesting the

Re: ow Integers Should Work

2011-12-05 Thread Manu
> > Manu: > > > Also, contrary to his claim, I find that wrapping is usually what I > > DO want in this case.. > > It's super rare that I write any code that pushes the limits of an int > > (unless we're talking 8-16 bit, see my range+saturation comment before), > > and when I do write code that pu

Re: ow Integers Should Work

2011-12-05 Thread bearophile
Manu: > Also, contrary to his claim, I find that wrapping is usually what I > DO want in this case.. > It's super rare that I write any code that pushes the limits of an int > (unless we're talking 8-16 bit, see my range+saturation comment before), > and when I do write code that pushes the range

Re: ow Integers Should Work

2011-12-05 Thread Timon Gehr
On 12/05/2011 06:25 PM, Andrei Alexandrescu wrote: On 12/5/11 10:37 AM, Don wrote: On 05.12.2011 14:31, bearophile wrote: Found through Reddit, two blog posts about how integers should behave in system languages (with hardware support): http://blog.regehr.org/archives/641 http://blog.regehr.or

Re: ow Integers Should Work

2011-12-05 Thread bearophile
Andrei Alexandrescu: > Agreed. One thought that comes to mind is using the small int > optimization for BigInt, i.e. use no dynamic allocation and built-in > operations whenever possible if the value is small enough. Does BigInt > currently do that? Both the small int optimization (32 or 64 bi

Re: ow Integers Should Work

2011-12-05 Thread Andrei Alexandrescu
On 12/5/11 10:37 AM, Don wrote: On 05.12.2011 14:31, bearophile wrote: Found through Reddit, two blog posts about how integers should behave in system languages (with hardware support): http://blog.regehr.org/archives/641 http://blog.regehr.org/archives/642 Bye, bearophile Not very convincin

Re: ow Integers Should Work

2011-12-05 Thread Manu
I can agree that in some circumstances, a ranged and saturated integer mode would be REALLY handy (colours, sound samples), but I can't buy in with the whole trapping overflows and stuff... most architectures will require explicit checking of the overflow bit after every operation to support this.

Re: ow Integers Should Work

2011-12-05 Thread Don
On 05.12.2011 14:31, bearophile wrote: Found through Reddit, two blog posts about how integers should behave in system languages (with hardware support): http://blog.regehr.org/archives/641 http://blog.regehr.org/archives/642 Bye, bearophile Not very convincing, since he proposes a change to

ow Integers Should Work

2011-12-05 Thread bearophile
Found through Reddit, two blog posts about how integers should behave in system languages (with hardware support): http://blog.regehr.org/archives/641 http://blog.regehr.org/archives/642 Bye, bearophile