On Wednesday, 21 March 2018 at 16:29:26 UTC, aerto wrote:
thanks, a last question in a diffrent function i use
use
BigInt i =
"105312291668557186697918027683670432318895095400549111254310977536";
and it should work. Note the quotation marks - it reads it as a
string because a long number
On Wednesday, 21 March 2018 at 16:00:56 UTC, Adam D. Ruppe wrote:
On Wednesday, 21 March 2018 at 15:56:00 UTC, aerto wrote:
why pow(256, 27) gives 0, instead of
105312291668557186697918027683670432318895095400549111254310977536L
that result is simply too big to fit in the result. Try using a
On Wed, Mar 21, 2018 at 03:56:00PM +, aerto via Digitalmars-d wrote:
> why pow(256, 27) gives 0, instead of
> 105312291668557186697918027683670432318895095400549111254310977536L
Because 256, being an int type, can only hold a 32-bit result, the
maximum of which is 2^31 (or 2^32 if you use
On Wednesday, 21 March 2018 at 15:56:00 UTC, aerto wrote:
why pow(256, 27) gives 0, instead of
105312291668557186697918027683670432318895095400549111254310977536L
that result is simply too big to fit in the result. Try using a
bigint instead:
import std.bigint, std.stdio;
void main() {
On Wednesday, 24 August 2016 at 19:41:35 UTC, ag0aep6g wrote:
-y1 is -1. But -y2 is uint.max, i.e. a pretty large positive
number.
The 'u' in "uint" stands for "unsigned". That is, it doesn't
know negative numbers. Dont' use uint when you need negative
numbers.
Ahh, doh.
On Wednesday, 24 August 2016 at 19:16:56 UTC, jmh530 wrote:
I'm a little confused on why pow behaves so differently when
switching from an int to a uint for the exponent.
import std.math : pow;
import std.stdio : writeln;
void main()
{
float x = 2;
int y1 = 1;
uint y2
On 01/13/2012 07:48 AM, bearophile wrote:
This is the third time I see people trip on power operator precedence:
http://d.puremagic.com/issues/show_bug.cgi?id=7268
Some people expect this:
(-10 ^^ 2)
To be 100 instead of -100
(Note: Python here uses the same operator precedences.)
Do you think
Chad J:
Parentheses would be required, so one must write
(-10)^^2
or
-(10^^2)
I imagine this would make sense for all unary operators colliding with ^^:
Is this wise and good? What are Walter Andrei Don thinking about this?
Bye,
bearophile
On 1/13/2012 5:39 PM, Walter Bright wrote:
On 1/13/2012 11:25 AM, Manu wrote:
Fair call. I buy this argument. If there is a precedent set by
(multiple) other
languages towards this precedence (and none against), then so be it.
If there were a vote though, I'd vote for it being deprecated on
El 13/01/2012 21:29, bearophile escribió:
Bioinformatics, exploratory programing, simulations, data munging, hardening of
slow scripts, data visualization, data mining, optimization of some tasks,
faster routines for dynamic code written by other people, and more.
The problem is that often
On 01/14/2012 02:56 PM, Mehrdad wrote:
On 1/13/2012 5:39 PM, Walter Bright wrote:
On 1/13/2012 11:25 AM, Manu wrote:
Fair call. I buy this argument. If there is a precedent set by
(multiple) other
languages towards this precedence (and none against), then so be it.
If there were a vote though,
the problem is, that there are two popular use cases of this
expression. One is plain old power expression and the other is writing
scientific notations of numbers. I thing we should stick with the
first use case, because at least for literals we already have
scientific notation.
On Fri, Jan 13,
2012/1/13 bearophile bearophileh...@lycos.com:
This is the third time I see people trip on power operator precedence:
http://d.puremagic.com/issues/show_bug.cgi?id=7268
Some people expect this:
(-10 ^^ 2)
To be 100 instead of -100
(Note: Python here uses the same operator precedences.)
Do
On 13 January 2012 14:48, bearophile bearophileh...@lycos.com wrote:
This is the third time I see people trip on power operator precedence:
http://d.puremagic.com/issues/show_bug.cgi?id=7268
Some people expect this:
(-10 ^^ 2)
To be 100 instead of -100
(Note: Python here uses the same
Le 13/01/2012 13:48, bearophile a écrit :
This is the third time I see people trip on power operator precedence:
http://d.puremagic.com/issues/show_bug.cgi?id=7268
Some people expect this:
(-10 ^^ 2)
To be 100 instead of -100
(Note: Python here uses the same operator precedences.)
Do
On Fri, Jan 13, 2012 at 7:47 AM, Manu turkey...@gmail.com wrote:
On 13 January 2012 14:48, bearophile bearophileh...@lycos.com wrote:
This is the third time I see people trip on power operator precedence:
http://d.puremagic.com/issues/show_bug.cgi?id=7268
Some people expect this:
(-10 ^^ 2)
On Fri, 2012-01-13 at 08:09 -0600, Andrew Wiley wrote:
On Fri, Jan 13, 2012 at 7:47 AM, Manu turkey...@gmail.com wrote:
On 13 January 2012 14:48, bearophile bearophileh...@lycos.com wrote:
This is the third time I see people trip on power operator precedence:
On 13/01/12 14:47, Manu wrote:
On 13 January 2012 14:48, bearophile bearophileh...@lycos.com
mailto:bearophileh...@lycos.com wrote:
This is the third time I see people trip on power operator precedence:
http://d.puremagic.com/issues/show_bug.cgi?id=7268
Some people expect this:
13.01.2012 19:56, Don Clugston пишет:
On 13/01/12 14:47, Manu wrote:
On 13 January 2012 14:48, bearophile bearophileh...@lycos.com
mailto:bearophileh...@lycos.com wrote:
This is the third time I see people trip on power operator precedence:
http://d.puremagic.com/issues/show_bug.cgi?id=7268
bearophile wrote:
This is the third time I see people trip on power operator precedence:
http://d.puremagic.com/issues/show_bug.cgi?id=7268
Some people expect this:
(-10 ^^ 2)
To be 100 instead of -100
(Note: Python here uses the same operator precedences.)
Why x ^^ y is considered _unary_
On 1/13/2012 8:59 AM, Mehrdad wrote:
On 1/13/2012 4:48 AM, bearophile wrote:
This is the third time I see people trip on power operator precedence:
http://d.puremagic.com/issues/show_bug.cgi?id=7268
Some people expect this:
(-10 ^^ 2)
To be 100 instead of -100
(Note: Python here uses the same
I feel it should be left as is: it'll be ambiguous either way and why mess
with how it's in mathematics? If anyone feels uncomfortable using it,
just use std.math.pow. Many other languages don't have this operator so
people coming from them won't know it exists anyway (like me until this
post).
—
On 13 January 2012 16:09, Andrew Wiley wiley.andre...@gmail.com wrote:
On Fri, Jan 13, 2012 at 7:47 AM, Manu turkey...@gmail.com wrote:
On 13 January 2012 14:48, bearophile bearophileh...@lycos.com wrote:
This is the third time I see people trip on power operator precedence:
On 13 January 2012 17:56, Don Clugston d...@nospam.com wrote:
On 13/01/12 14:47, Manu wrote:
On 13 January 2012 14:48, bearophile bearophileh...@lycos.com
mailto:bearophileHUGS@lycos.**com bearophileh...@lycos.com wrote:
This is the third time I see people trip on power operator
On 13 January 2012 19:41, Matej Nanut matejna...@gmail.com wrote:
I feel it should be left as is: it'll be ambiguous either way and why mess
with how it's in mathematics? If anyone feels uncomfortable using it,
just use std.math.pow. Many other languages don't have this operator so
people
On 13/01/2012 13:47, Manu wrote:
snip
Some people expect this:
(-10 ^^ 2)
To be 100 instead of -100
snip
I'm fairly amazed it's not the other way around... what's the logic behind this?
It matches standard mathematical notation. -x² means -(x²) not (-x)².
This actually makes
On 13/01/2012 18:18, Manu wrote:
snip
It's NOT like it is in mathematics, there is no 'operator' in mathematics
(maths uses a
superscript, which APPEARS to be a unary operation). When using the operator,
with spaces
on either side, it looks like (and is) a binary operator.
snip
Actually,
Oh, yeah, my bad. I've been at uni for too long: seeing subscripts as ^a...
I agree that an operator for this is unnecessary though. At least I have never
felt the need to write pow(,) quicker than 6 symbols.
On another note, Octave (and I guess Matlab as well?) use D's precedence
for the pow
The logic is that the precedence in the language matches the
precedence of a written equation.
But the operator looks nothing like the written equation... nothing at all
like the written equation.
Perhaps D could support the unicode characters '²' '³' or 'ª' as kinda handy
On 13 January 2012 20:46, Matej Nanut matejna...@gmail.com wrote:
On another note, Octave (and I guess Matlab as well?) use D's precedence
for the pow operator. Bearophile stated earlier that Python does too. Those
seem like quite large audiences. I'm not saying agreeing with the masses
is
Don:
Originally it worked the other way, but bearophile complained about it,
so it got changed to this way g.
If I port Python code to D I prefer the current design. I have opened this
thread to see if there are ways to mitigate some of the future problems caused
by that :-)
Of my past
On 13 January 2012 21:31, bearophile bearophileh...@lycos.com wrote:
What I wonder is why this operator is necessary at all?
It's not necessary, like most other features in a language, like for
loops. But it's handy and very useful, I am now using one power operator
about every 40 or 50
Manu:
What are you working on if I may ask?
Bioinformatics, exploratory programing, simulations, data munging, hardening of
slow scripts, data visualization, data mining, optimization of some tasks,
faster routines for dynamic code written by other people, and more.
I do tend to write a
Manu turkey...@gmail.com wrote in message
news:mailman.328.1326483521.16222.digitalmar...@puremagic.com...
On 13 January 2012 21:24, Grue g...@nop.com wrote:
Beware... your statement has awoken an Ancient Forum Lurker! ;)
Sweet! I have that effect :P
Arise!
In my prior post I agreed, though
On 01/13/2012 07:18 PM, Manu wrote:
On 13 January 2012 19:41, Matej Nanut matejna...@gmail.com
mailto:matejna...@gmail.com wrote:
I feel it should be left as is: it'll be ambiguous either way and
why mess
with how it's in mathematics? If anyone feels uncomfortable using it,
just
Nick Sabalausky a@a.a skrev i meddelandet
news:jeq6h1$18mu$1...@digitalmars.com...
Manu turkey...@gmail.com wrote in message
news:mailman.328.1326483521.16222.digitalmar...@puremagic.com...
On 13 January 2012 21:24, Grue g...@nop.com wrote:
Beware... your statement has awoken an Ancient
On 13/01/2012 19:24, Grue wrote:
snip
Beware... your statement has awoken an Ancient Forum Lurker! ;)
1. Google -5^2, result: -(5^2) = -25
2. Start ancient TI graphing calculator(which by the way has a special unary
(-) minus
operator).
-5^2 = -25
-5*²* = -25
snip
And probably most BASICs.
My HP 49g+ does -2^2 = -4 as well (with special unary minus), in algebraic
mode. Would love to test it on the 41C, but it only has RPN. ^_^
I've been swayed into the »let's keep it« direction.
I'll start using it, too. It even works as an array operator. =D
On 14 January 2012 00:30, Stewart
On 1/13/2012 11:25 AM, Manu wrote:
Fair call. I buy this argument. If there is a precedent set by (multiple) other
languages towards this precedence (and none against), then so be it.
If there were a vote though, I'd vote for it being deprecated on grounds of
offering nothing to the language
39 matches
Mail list logo