On 10/2/22 09:24, Fausto via Digitalmars-d-learn wrote:
Thanks a lot. I am to used to C and, more important, I didn't think to look for
also another operator for the power function :)
Oh, and I forgot to mention that this is doing what you probably asked for
originally:
```d
import std;
imp
On 10/2/22 09:24, Fausto via Digitalmars-d-learn wrote:
Thanks a lot. I am to used to C and, more important, I didn't think to look for
also another operator for the power function :)
D does have pow and many other useful math functions [1], it's just not defined
for BitInts. Oh, and speakin
On Sunday, 2 October 2022 at 02:02:37 UTC, rassoc wrote:
On 10/2/22 00:04, Fausto via Digitalmars-d-learn wrote:
Hello,
I am trying to use pow with an integer argument, but I cannot
have a bigint result, for example, ```pow(10,72)```.
Do I have to write my pow function or is there a native
On 10/2/22 00:04, Fausto via Digitalmars-d-learn wrote:
Hello,
I am trying to use pow with an integer argument, but I cannot have a bigint
result, for example, ```pow(10,72)```.
Do I have to write my pow function or is there a native solution?
thanks,
Fausto
In contrast to certain
Hello,
I am trying to use pow with an integer argument, but I cannot
have a bigint result, for example, ```pow(10,72)```.
Do I have to write my pow function or is there a native solution?
thanks,
Fausto
On Saturday, 11 June 2022 at 13:09:44 UTC, vc wrote:
Hello, is there any way to represnts a sha256 hash like
2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824 in BigInt ?
I've try so far auto t =
BigInt("2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b
On Saturday, 11 June 2022 at 13:09:44 UTC, vc wrote:
Hello, is there any way to represnts a sha256 hash like
2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824 in BigInt ?
I've try so far auto t =
BigInt("2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b
Hello, is there any way to represnts a sha256 hash like
2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824
in BigInt ?
I've try so far auto t =
BigInt("2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824") and it gives me invalid digit
On Wednesday, 6 December 2017 at 10:16:16 UTC, helxi wrote:
On Wednesday, 6 December 2017 at 10:00:48 UTC, Biotronic wrote:
AliasSeq!(a, b) = tuple(
a * (2*b - a),
a*a + b*b);
[...]
Nice. But why the AliasSeq?
Just playing around a bit. The alternative is to
On Wednesday, 6 December 2017 at 09:59:12 UTC, codephantom wrote:
On Wednesday, 6 December 2017 at 09:12:08 UTC, helxi wrote:
This is question not directly related to language concepts,
it's got more to do with the application. I would appreciate
if anyone would point to me how I could optimize
On Wednesday, 6 December 2017 at 10:00:48 UTC, Biotronic wrote:
On Wednesday, 6 December 2017 at 09:12:08 UTC, helxi wrote:
[...]
Here's my version:, based on fast squaring:
auto fib(ulong n) {
import std.bigint : BigInt;
import std.meta : AliasSeq;
import std.typecons :
t squaring:
auto fib(ulong n) {
import std.bigint : BigInt;
import std.meta : AliasSeq;
import std.typecons : tuple;
BigInt a = 0;
BigInt b = 1;
auto bit = 63;
while (bit > 0) {
AliasSeq!(a, b) = tuple(
a * (2*b - a),
a*a + b*b);
On Wednesday, 6 December 2017 at 09:12:08 UTC, helxi wrote:
This is question not directly related to language concepts,
it's got more to do with the application. I would appreciate if
anyone would point to me how I could optimize this bit of code
Compile it with ldc ;-)
On Wednesday, December 06, 2017 09:12:08 helxi via Digitalmars-d-learn
wrote:
> void main()
> {
> import std.stdio, std.datetime;
>
> auto t0 = Clock.currTime;
> writeln(fib(100_000));
> writeln(Clock.currTime - t0);
> }
On a complete sidenote, if you want to correctly time stuff, you sho
This is question not directly related to language concepts, it's
got more to do with the application. I would appreciate if anyone
would point to me how I could optimize this bit of code
auto fib(const int n)
{
import std.bigint;
if (n == 0)
return Big
On 8/9/17 9:08 PM, Steven Schveighoffer wrote:
Right, but this is not a limitation of the API, just the implementation.
It could be improved.
https://issues.dlang.org/show_bug.cgi?id=17736
Based on H.S. Teoh's comment in the bug report, this actually is invalid.
That's a tough requirement.
= key;key < limit;++key)
{
// use x
}
That's enough to know that the foreach loop does not reuse the space
for the iteration variable. That was what I cared about.
Note that using BigInt as iteration variable will probably cause a
BigInt allocation per iteration, because operations
(auto x = key;key < limit;++key)
> > {
> > // use x
> > }
>
> That's enough to know that the foreach loop does not reuse the space
> for the iteration variable. That was what I cared about.
Note that using BigInt as iteration variable will probably cause a
Big
On Friday, 4 August 2017 at 16:40:08 UTC, Stefan Koch wrote:
[..]
foreach(x;A .. B)
it's lowerd to
auto limit = B;
auto key = A;
for(auto x = key;key < limit;++key)
{
// use x
}
That's enough to know that the foreach loop does not reuse the
space for the iteration variable. That was what I c
e result is the same.
> as incrementing is a costly operation?
Here is increment in bigint:
https://github.com/dlang/phobos/blob/master/std/bigint.d#L563
And addOrSubInt:
https://github.com/dlang/phobos/blob/master/std/internal/math/biguintcore.d#L508
I think there is room for impr
On 8/4/17 8:49 AM, Q. Schroll wrote:
One can do
BigInt n = returnsBigInt();
foreach (i; BigInt(0) .. n)
{ .. }
How is this implemented? The code for BigInt is very large and I didn't
find it.
And is it more efficient than
for (BigInt i = 0; i < n; ++i)
{ .. }
Any forea
On Friday, 4 August 2017 at 12:49:30 UTC, Q. Schroll wrote:
One can do
BigInt n = returnsBigInt();
foreach (i; BigInt(0) .. n)
{ .. }
How is this implemented? The code for BigInt is very large and
I didn't find it.
And is it more efficient than
for (BigInt i = 0; i <
One can do
BigInt n = returnsBigInt();
foreach (i; BigInt(0) .. n)
{ .. }
How is this implemented? The code for BigInt is very large and I
didn't find it.
And is it more efficient than
for (BigInt i = 0; i < n; ++i)
{ .. }
as incrementing is a costly operation?
On Saturday, 8 April 2017 at 12:14:31 UTC, Russel Winder wrote:
On Fri, 2017-04-07 at 22:47 +, Meta via Digitalmars-d-learn
wrote:
[…]
Do you have the -dip1000 switch enabled?
Not as far as I know. Why would I want to do that?
You wouldn't as the std lib doesn't work with it yet.
/Factorial/tree/master/D
So, factorial.d:71 is this:
tuple(30, immutable BigInt("26525285981219105863630848000")),
And the BigInt constructor you're trying to use there is this one [1]:
this(Range)(Range s) if (
isBidirectionalRange!Range &&
On Saturday, 8 April 2017 at 12:16:10 UTC, Russel Winder wrote:
Fedora Rawhide is now on LLVM 4.0 is that going to be a problem
building LDC?
Of course not! ;-)
-Johan
On Fri, 2017-04-07 at 20:29 +, Jack Stouffer via Digitalmars-d-
learn wrote:
> On Friday, 7 April 2017 at 17:06:31 UTC, Russel Winder wrote:
> > Simple Dub build of a Factorial example using Unit-Threaded for
> > testing. Works fine with ldc2 breaks with dmd.
>
> Can you post the code your us
On Fri, 2017-04-07 at 20:38 +, David Nadlinger via Digitalmars-d-
learn wrote:
> […]
>
> You might want to check with LDC from Git master first to see
> whether it is in fact a 2.073-related problem. — David
Rats, I thought I'd got away from manually building LDC.
Fedora Rawhide is now on L
On Fri, 2017-04-07 at 22:47 +, Meta via Digitalmars-d-learn wrote:
> […]
>
> Do you have the -dip1000 switch enabled?
Not as far as I know. Why would I want to do that?
--
Russel.
=
Dr Russel Winder t: +44 20 7
mutable, candidates are:
/usr/include/dmd/phobos/std/bigint.d(64,5):
std.bigint.BigInt.__ctor(Range)(Range s) if
(isBidirectionalRange!Range && isSomeChar!(ElementType!Range)
&& !isInfinite!Range)
/usr/include/dmd/phobos/std/bigint.d(146,5):
std.bigint.BigInt.__cto
On Friday, 7 April 2017 at 17:06:31 UTC, Russel Winder wrote:
If anyone has any useful intelligence as to what happening and
how I
can workaround it, I'd be a grateful bunny.
You might want to check with LDC from Git master first to see
whether it is in fact a 2.073-related problem. — David
On Friday, 7 April 2017 at 17:06:31 UTC, Russel Winder wrote:
Simple Dub build of a Factorial example using Unit-Threaded for
testing. Works fine with ldc2 breaks with dmd.
Can you post the code your using?
):
std.bigint.BigInt.__ctor(Range)(Range s) if (isBidirectionalRange!Range &&
isSomeChar!(ElementType!Range) && !isInfinite!Range)
/usr/include/dmd/phobos/std/bigint.d(146,5):
std.bigint.BigInt.__ctor(T)(T x) if (isIntegral!T)
/usr/include/dmd/phobos/std/bigint.d(162,5)
On Wednesday, 2 November 2016 at 15:15:18 UTC, Andrea Fontana
wrote:
Why don't you perform a binary search over 200 power of 2?
Something like: http://paste.ofcode.org/scMD5JbmLMZkrv3bWRmPPT
I wonder if a simple binary search on whole array is faster than
search for limits as in this example
calculate the ceil of log2 of a
bigint. Help?
How big are your bigints?
I think they'll generally stay between 0 and 2^200
I came up with this, I guess it'll work?
auto clog2(BigInt number) in{
assert(number > 0);
}body{
uint log;
auto n = number -
On Wednesday, 2 November 2016 at 14:24:42 UTC, Andrea Fontana
wrote:
On Wednesday, 2 November 2016 at 14:05:50 UTC, pineapple wrote:
I'm trying to do some math stuff with std.bigint and realized
there's no obvious way to calculate the ceil of log2 of a
bigint. Help?
How big are yo
On Wednesday, 2 November 2016 at 14:05:50 UTC, pineapple wrote:
I'm trying to do some math stuff with std.bigint and realized
there's no obvious way to calculate the ceil of log2 of a
bigint. Help?
How big are your bigints?
I'm trying to do some math stuff with std.bigint and realized
there's no obvious way to calculate the ceil of log2 of a bigint.
Help?
On Friday, 6 November 2015 at 10:00:23 UTC, Namal wrote:
On Thursday, 5 November 2015 at 17:40:12 UTC, bearophile wrote:
Namal:
Hello I am trying to convert BigInt to string like that while
trying to sort it:
void main() {
import std.stdio, std.algorithm, std.conv, std.bigint
On Thursday, 5 November 2015 at 17:40:12 UTC, bearophile wrote:
Namal:
Hello I am trying to convert BigInt to string like that while
trying to sort it:
void main() {
import std.stdio, std.algorithm, std.conv, std.bigint,
std.string;
auto n = 17.BigInt ^^ 179
On Thursday, 5 November 2015 at 20:45:45 UTC, TheGag96 wrote:
Whoa whoa whoa... This is the first time I've heard about this
difference, and I've used .sort plenty of times... That seems
like really, REALLY bad design, especially considering the
language allows functions to be called without pa
On Thursday, 5 November 2015 at 16:45:10 UTC, Meta wrote:
The second issue is that using .sort instead of .sort() (note
the parentheses) calls the built-in sort instead of
std.algorithm.sort, which is strongly discouraged. You should
always use std.algorithm.sort over the built-in sort, which y
On Thursday, 5 November 2015 at 19:38:23 UTC, Ali Çehreli wrote:
Good one! ;) I'm really happy that he is still around.
Ali
So am I! The more, the merrier!
On 11/05/2015 11:35 AM, Chris wrote:
On Thursday, 5 November 2015 at 19:30:02 UTC, Ali Çehreli wrote:
On 11/05/2015 09:40 AM, bearophile wrote:
Bye,
bearophile
Were you immersed in another language? Rust?
Ali
His D doesn't seem to be Rusty though!
Good one! ;) I'm really happy that he i
On Thursday, 5 November 2015 at 19:30:02 UTC, Ali Çehreli wrote:
On 11/05/2015 09:40 AM, bearophile wrote:
Bye,
bearophile
Were you immersed in another language? Rust?
Ali
His D doesn't seem to be Rusty though!
On 11/05/2015 09:40 AM, bearophile wrote:
Bye,
bearophile
Were you immersed in another language? Rust?
Ali
void main() {
import std.stdio, std.algorithm, std.conv, std.bigint,
std.string;
auto n = 17.BigInt ^^ 179;
n.text.dup.representation.sort().release.assumeUTF.writeln;
}
Better:
n.to!(char[]).representation.sort().release.assumeUTF.writeln;
Bye,
bearophile
Namal:
Hello I am trying to convert BigInt to string like that while
trying to sort it:
void main() {
import std.stdio, std.algorithm, std.conv, std.bigint,
std.string;
auto n = 17.BigInt ^^ 179;
n.text.dup.representation.sort().release.assumeUTF.writeln;
}
Bye,
bearophile
On Thursday, 5 November 2015 at 17:13:07 UTC, Ilya Yaroshenko
wrote:
string s1 = to!string(a).dup.sort.idup;
well, but I was just told not to use sort ??
On Thursday, 5 November 2015 at 16:53:50 UTC, Namal wrote:
On Thursday, 5 November 2015 at 16:45:10 UTC, Meta wrote:
On Thursday, 5 November 2015 at 16:29:30 UTC, Namal wrote:
Hello I am trying to convert BigInt to string like that while
trying to sort it:
string s1 = to!string(a).dup.sort
On Thursday, 5 November 2015 at 16:45:10 UTC, Meta wrote:
On Thursday, 5 November 2015 at 16:29:30 UTC, Namal wrote:
Hello I am trying to convert BigInt to string like that while
trying to sort it:
string s1 = to!string(a).dup.sort;
and get an error
cannot implicitly convert expression
On Thursday, 5 November 2015 at 16:29:30 UTC, Namal wrote:
Hello I am trying to convert BigInt to string like that while
trying to sort it:
string s1 = to!string(a).dup.sort;
and get an error
cannot implicitly convert expression (_adSortChar(dup(to(a
of type char[] to string
what do I
On Thursday, 5 November 2015 at 16:39:03 UTC, Namal wrote:
On Thursday, 5 November 2015 at 16:35:01 UTC, BBasile wrote:
On Thursday, 5 November 2015 at 16:29:30 UTC, Namal wrote:
Hello I am trying to convert BigInt to string like that while
trying to sort it:
string s1 = to!string(a
On Thursday, 5 November 2015 at 16:35:01 UTC, BBasile wrote:
On Thursday, 5 November 2015 at 16:29:30 UTC, Namal wrote:
Hello I am trying to convert BigInt to string like that while
trying to sort it:
string s1 = to!string(a).dup.sort;
and get an error
cannot implicitly convert expression
On Thursday, 5 November 2015 at 16:29:30 UTC, Namal wrote:
Hello I am trying to convert BigInt to string like that while
trying to sort it:
string s1 = to!string(a).dup.sort;
and get an error
cannot implicitly convert expression (_adSortChar(dup(to(a
of type char[] to string
what do I
Hello I am trying to convert BigInt to string like that while
trying to sort it:
string s1 = to!string(a).dup.sort;
and get an error
cannot implicitly convert expression (_adSortChar(dup(to(a of
type char[] to string
what do I do wrong?
wrote:
[...]
Should be plusTwo(in BigInt n) instead.
Yes, I had aliased BigInt to bigint.
And I checked and it compiles for me too with Windows m64.
That makes it seem more like a bug than a feature.
I'll open a bug report.
Paul
The point here is that x86 uses an assembler-opti
On Sunday, 5 July 2015 at 20:35:03 UTC, Kai Nacke wrote:
On Friday, 3 July 2015 at 04:08:32 UTC, Paul D Anderson wrote:
On Friday, 3 July 2015 at 03:57:57 UTC, Anon wrote:
On Friday, 3 July 2015 at 02:37:00 UTC, Paul D Anderson wrote:
[...]
Should be plusTwo(in BigInt n) instead.
Yes
On Friday, 3 July 2015 at 04:08:32 UTC, Paul D Anderson wrote:
On Friday, 3 July 2015 at 03:57:57 UTC, Anon wrote:
On Friday, 3 July 2015 at 02:37:00 UTC, Paul D Anderson wrote:
enum BigInt test1 = BigInt(123);
enum BigInt test2 = plusTwo(test1);
public static BigInt plusTwo(in bigint n
On Friday, 3 July 2015 at 02:37:00 UTC, Paul D Anderson wrote:
The following code fails to compile and responds with the given
error message. Varying the "plusTwo" function doesn't work; as
long as there is an arithmetic operation the error occurs.
[...]
https://issues.dlang.org/show_bug.cgi
On Friday, 3 July 2015 at 03:57:57 UTC, Anon wrote:
On Friday, 3 July 2015 at 02:37:00 UTC, Paul D Anderson wrote:
enum BigInt test1 = BigInt(123);
enum BigInt test2 = plusTwo(test1);
public static BigInt plusTwo(in bigint n)
Should be plusTwo(in BigInt n) instead.
Yes, I had aliased
10.10 (Yosemite) using DMD64 D Compiler
v2.067.1.
It seems to mean that there is no way to modify a BigInt at
compile time. This seriously limits the usability of the type.
enum BigInt test1 = BigInt(123);
enum BigInt test2 = plusTwo(test1);
public static BigInt plusTwo(in bigint n)
Shoul
The following code fails to compile and responds with the given
error message. Varying the "plusTwo" function doesn't work; as
long as there is an arithmetic operation the error occurs.
It seems to mean that there is no way to modify a BigInt at
compile time. This serio
On Saturday, 25 April 2015 at 21:13:29 UTC, Ali Çehreli wrote:
On 04/25/2015 01:23 PM, Dennis Ritchie wrote:
which section should apply similar requests?
https://issues.dlang.org/
After clicking "File and Issue":
Component: Phobos
Severity: Enhancement
Ali
Thanks. I reported this:
-
ht
On 04/25/2015 01:23 PM, Dennis Ritchie wrote:
which section should apply similar requests?
https://issues.dlang.org/
After clicking "File and Issue":
Component: Phobos
Severity: Enhancement
Ali
On Saturday, 25 April 2015 at 18:58:50 UTC, Marc Schütz wrote:
BigInt only supports %d, %x, %X and %s:
http://dlang.org/phobos/std_bigint.html#.BigInt.toString
The missing %o and %b were probably an oversight, feel free to
file an enhancement request or submit a PR.
All right. I will file a
On Saturday, 25 April 2015 at 13:13:10 UTC, Dennis Ritchie wrote:
Hi,
Is there a way to apply a function "format" with BigInt?
-
import std.stdio, std.bigint, std.string;
void main() {
BigInt n = -10;
string s = format("%b", n); // error
wr
Hi,
Is there a way to apply a function "format" with BigInt?
-
import std.stdio, std.bigint, std.string;
void main() {
BigInt n = -10;
string s = format("%b", n); // error
writeln(s);
}
On Tuesday, 24 March 2015 at 17:35:14 UTC, matovitch wrote:
xor it with -1 instead of 1. (-1 is store as 0xfff..f with the
classic modular arithmetic)
Thanks.
er of type BigInt,
while I would like to store each number in the binary
representation of the array BigInt.
xor it with -1 instead of 1. (-1 is store as 0xfff..f with the
classic modular arithmetic)
On Tuesday, 24 March 2015 at 16:35:04 UTC, Ivan Kazmenko wrote:
What exactly is not working?
Everything works. I'm just a little forgotten properties of the
operation xor.
I just wanted to xor 1 each digit in the number of type BigInt,
while I would like to store each number in the b
On Tuesday, 24 March 2015 at 15:45:36 UTC, Dennis Ritchie wrote:
Tell me, please, how can I replace this code?
import std.conv : to;
import std.bigint : BigInt;
import std.string : format;
import std.stdio : writeln;
void main() {
BigInt[10] bitArr;
ulong n
On Tuesday, 24 March 2015 at 15:45:36 UTC, Dennis Ritchie wrote:
Tell me, please, how can I replace this code?
import std.conv : to;
import std.bigint : BigInt;
import std.string : format;
import std.stdio : writeln;
void main() {
BigInt[10] bitArr;
ulong n
On Tuesday, 24 March 2015 at 15:45:36 UTC, Dennis Ritchie wrote:
Tell me, please, how can I replace this code?
import std.conv : to;
import std.bigint : BigInt;
import std.string : format;
import std.stdio : writeln;
void main() {
BigInt[10] bitArr;
ulong n
Tell me, please, how can I replace this code?
import std.conv : to;
import std.bigint : BigInt;
import std.string : format;
import std.stdio : writeln;
void main() {
BigInt[10] bitArr;
ulong n = 18_446_724_073_709_551_614U;
bitArr[0] = format("%b", n)
On Tuesday, 17 February 2015 at 07:20:19 UTC, Ivan Kazmenko wrote:
The readf function does not seem to support reading BigInts
directly.
However, you can read a string and construct a BigInt from it,
either by std.conv.to or directly invoking the constructor:
import std.algorithm
On Monday, 16 February 2015 at 19:52:20 UTC, Dennis Ritchie wrote:
Hi.
And how to read Data from the input stream?
import std.stdio;
import std.bigint;
void main() {
BigInt n;
readf(" %?", &n);
writeln(n);
}
The readf function does not seem to s
Hi.
And how to read Data from the input stream?
import std.stdio;
import std.bigint;
void main() {
BigInt n;
readf(" %?", &n);
writeln(n);
}
On Thu, 2015-01-22 at 10:21 -0800, H. S. Teoh via Digitalmars-d-learn
wrote:
[…]
>
> https://github.com/D-Programming-Language/phobos/pull/2895
>
> This is just the tip of the iceberg. The full enhancement is described
> in:
>
> https://issues.dlang.org/show_bug.cgi?id=10762
>
Sadly, I s
On Thu, Jan 22, 2015 at 05:12:17PM +, Russel Winder via Digitalmars-d-learn
wrote:
> Using reduce for factorial, seems to require iota, not a bad things
> per se, with ulongs:
>
> reduce!"a*b"(1, iota(1, n + 1))
>
> works fine. Now switch to BigInt:
>
Using reduce for factorial, seems to require iota, not a bad things per
se, with ulongs:
reduce!"a*b"(1, iota(1, n + 1))
works fine. Now switch to BigInt:
reduce!"a*b"(one, iota(one, n + one))
fails to compile, one and n + one are of different types. Pr
Great! Thanks a lot.
Kind regards
André
On Friday, 19 December 2014 at 08:47:50 UTC, bearophile wrote:
Andre:
Do you have any idea how to translate the coding correctly?
Try:
i += long(buffer[3]) << 24 >>> 0;
But I also suggest to add parentheses, to make the code less
unreadable for hum
Andre:
Do you have any idea how to translate the coding correctly?
Try:
i += long(buffer[3]) << 24 >>> 0;
But I also suggest to add parentheses, to make the code less
unreadable for humans.
Bye,
bearophile
294967295
But in D the last statement returns -1, the previous 3 statements
returns the same values like in JavaScript.
I tried "long" and also like in the example "BigInt", both do not
work correctly. In the documentation it is also mentioned that
is not supported for &qu
On Sunday, June 16, 2013 05:14:07 Tyro[17] wrote:
> The following code:
>
> void main()
> {
> import std.bigint;
> BigInt x, m;
> BigInt l = x & m;
> }
>
> Result in:
> andrew@ace:~$ dmd f
> f.d(6): Error: 'x' is not of integra
The following code:
void main()
{
import std.bigint;
BigInt x, m;
BigInt l = x & m;
}
Result in:
andrew@ace:~$ dmd f
f.d(6): Error: 'x' is not of integral type, it is a BigInt
f.d(6): Error: 'm' is not of integral type, it is a BigInt
I'm s
working on computers where the bit width of x1...xN is
fixed (currently 32-bit or 64-bit), we can do better. If we concatenate
the elements of the sequence to form a 32*N (or 64*N) bit BigInt, that
also gives us a unique index for the sequence. Assuming that the numbers
in your sequence cover
alues are close to the maximum of their given type.
For this reason I've made use of BigInt internally and as a return value.
However, it occurs to me that it would be nice to avoid BigInt unless it's
necessary, both for speed/memory reasons and for convenience. I'm wondering if
a
novice2:
I hope, this changes will be included in phobos in future.
Sometimes hoping isn't enough. If you have a need that youi think
should be in Phobos, then I think you should ask for it in
Bugzilla. Asking isn't equal to someone actually implementing it,
but in this early stage of the l
Big thank you. I hope, this changes will be included in phobos in
future.
On Sunday, 25 November 2012 at 21:36:38 UTC, novice2 wrote:
How i can convert ubyte[] to BigInt and BigInt to ubyte[] ?
Or uint[]...
For example, i need RSA crypto. I should get ubyte[] data,
ubyte[] key, convert it to BigInt, calculate, then save result
as ubyte[] data again.
But i see
How i can convert ubyte[] to BigInt and BigInt to ubyte[] ?
Or uint[]...
For example, i need RSA crypto. I should get ubyte[] data,
ubyte[] key, convert it to BigInt, calculate, then save result as
ubyte[] data again.
But i see BigInt convertable to string only :(
On 09/05/2012 07:10 PM, bearophile wrote:
Ellery Newcomer:
Yep.
Oh, good.
Have any suggestions for supported conversion out of the box?
There are several important cases, like:
Some D lazy ranges <==> Python lazy iterators/generators
array.array <==> D arrays
NumPy arrays <==> D array
On 09/10/2012 10:50 PM, Russel Winder wrote:
Python 2 and Python 3 are totally different in this regard. I don't have
a obvious proposal to make to avoid having PyD for Python 2 and a
different PyD for Python 3, but the six package might have some hints as
it is intended to support creating Pyth
On Mon, 2012-09-10 at 15:54 -0700, Ellery Newcomer wrote:
[…]
> Bugger, I'm going to have to go through pyd and replace all usages
> of str with unicode.
Python 2 and Python 3 are totally different in this regard. I don't have
a obvious proposal to make to avoid having PyD for Python 2 and a
di
On 09/10/2012 12:11 PM, bearophile wrote:
I understand. The point of Pyd is to interface D and Python, while NumPy
is something external. So if you find difficulties just keep it out.
Adding it later is possible.
Thing is, pyd will convert a ndarray to d array already, it just won't
do it as
Ellery Newcomer:
I've been thinking about this one a bit more, and I am not sure
it belongs in pyd.
I understand. The point of Pyd is to interface D and Python,
while NumPy is something external. So if you find difficulties
just keep it out. Adding it later is possible.
Bye,
bearophile
On 09/05/2012 07:10 PM, bearophile wrote:
NumPy arrays <==> D arrays
I've been thinking about this one a bit more, and I am not sure it
belongs in pyd.
First, the conversion is not symmetric. One can convert a numpy.ndarray
to a d array like so:
PyObject* ndarray;
double[][] matrix = d_
Am Mon, 10 Sep 2012 14:48:30 +0200
schrieb Johannes Pfau :
> Sorry, I should have said 'It'll _probably_ never be supported in
> gdc'. There are some possible solutions but:
>
> * It must be good enough to get approved when gdc is merged into gcc.
> (remember it must be portable and gpl and you
Am Sun, 09 Sep 2012 12:55:19 -0700
schrieb Brad Roberts :
> On 9/9/2012 1:15 AM, Johannes Pfau wrote:
> > Am Sat, 08 Sep 2012 16:25:49 +0100
> > schrieb Russel Winder :
> >
> >> On Sat, 2012-09-08 at 07:20 -0700, Ellery Newcomer wrote:
> >> […]
> >>> Okay, here:
> >>> https://bitbucket.org/ariovi
1 - 100 of 145 matches
Mail list logo