User talk:Waldorf: Difference between revisions

(Fine by me...)
(→‎Primitive types: new section)
 
(5 intermediate revisions by 3 users not shown)
Line 11:
::Finally, I would like to develop a task to demonstrate how to make a data type that acts like a primitive data type but has programmer-defined characteristics such as a limited range of valid values. This task would include a demonstration, or discussion if the capability is built into the language, of how to implement the required range checking.
:::Sounds good to me. I'm not holding you back. I don't want to hold anyone back, really; This site grows as people add tasks. Of all the content on Rosetta Code, only around 10% was originally mine. --[[User:Short Circuit|Short Circuit]] 19:17, 26 February 2007 (EST)
 
== Lucas-Lehmer test ==
 
Hi,...
 
I'm not an ADA producer... but I think that your program may be
able to get a bit further if you changed the following line:
MP : Long_Long_Integer := 2**Item - 1;
To (in hybrid Ada/C at least):
MP : Long_Long_Integer := 2ULL**Item - 1;
(esp if the bit width on Int is ≤ ¼ of Long_Long_Integer's width)
 
The logic is Lucas-Lehmer should be generate n in 2*n-1 where n is
"almost" half the bit width of Long_Long_Integer. If this width is
128, then n should get to:
M2 M3 M5 M7 M13 M17 M19 M31 M61
Unsigned also help get to M127 if Long_Long_Integer is 32 bytes wide,
if there is such a thing.
 
Cheers [[User:NevilleDNZ|NevilleDNZ]] 02:59, 16 February 2008 (MST)
:I gather from your example above that you are suggesting the use of an unsigned integer type. I use a Windows XP OS. The largest unsigned number available to me on my Ada compiler is a 64 bit unsigned number, which yields the same result.--[[User:Waldorf|Waldorf]] 07:02, 16 February 2008 (MST)
 
== [[Monty Hall simulation]] results ==
Hi, Your sample results could be in error could you take a look at the comment in the MH talk page please, thanks. --[[User:Paddy3118|Paddy3118]] 15:24, 11 August 2008 (UTC)
:The problem was handled by increasing the number of iterations. The discrete random number generator in the GNAT compiler is flaky for small numbers of runs.--[[User:Waldorf|Waldorf]] 00:22, 15 August 2008 (UTC)
 
== Primitive types ==
 
There's some interest in the intention behind [[Talk:Defining Primitive Data Types|Defining Primitive Types]], if you can take a moment to weigh in. --[[User:Short Circuit|Short Circuit]] 02:53, 2 March 2009 (UTC)