On 2/26/18 6:34 PM, psychoticRabbit wrote:
On Sunday, 25 February 2018 at 14:52:19 UTC, Steven Schveighoffer wrote:
1 == 1.0, no?
no. at least, not when a language forces you to think in terms of types.
But you aren't. You are thinking in terms of text representation of
values (which is
On Mon, Feb 26, 2018 at 07:50:10PM -0700, Jonathan M Davis via
Digitalmars-d-learn wrote:
[...]
> One case that I found interesting was that in writing
> core.time.convClockFreq so that it didn't require floating point
> values, it not only avoided the inaccuracies caused by using FP, but
> it
On Monday, February 26, 2018 18:33:13 H. S. Teoh via Digitalmars-d-learn
wrote:
> Well, the way I deal with floating point is, design my code with the
> assumption that things will be inaccurate, and compensate accordingly.
The way that I usually deal with it is to simply not use floating point
On Mon, Feb 26, 2018 at 05:18:00PM -0700, Jonathan M Davis via
Digitalmars-d-learn wrote:
> On Monday, February 26, 2018 16:04:59 H. S. Teoh via Digitalmars-d-learn
> wrote:
[...]
> > (There *are* exact representations for certain subsets of
> > irrationals that allow fast computation that does
On Monday, February 26, 2018 17:49:21 H. S. Teoh via Digitalmars-d-learn
wrote:
> On Tue, Feb 27, 2018 at 12:26:56AM +, psychoticRabbit via Digitalmars-
d-learn wrote:
> > On Tuesday, 27 February 2018 at 00:04:59 UTC, H. S. Teoh wrote:
> > > A 64-bit double can only hold about 14-15 decimal
On Tue, Feb 27, 2018 at 12:26:56AM +, psychoticRabbit via
Digitalmars-d-learn wrote:
> On Tuesday, 27 February 2018 at 00:04:59 UTC, H. S. Teoh wrote:
> >
> > A 64-bit double can only hold about 14-15 decimal digits of
> > precision. Anything past that, and there's a chance your
> >
On Tuesday, 27 February 2018 at 00:04:59 UTC, H. S. Teoh wrote:
A 64-bit double can only hold about 14-15 decimal digits of
precision. Anything past that, and there's a chance your
"different" numbers are represented by exactly the same bits
and the computer can't tell the difference.
T
On Monday, February 26, 2018 16:04:59 H. S. Teoh via Digitalmars-d-learn
wrote:
> On Mon, Feb 26, 2018 at 11:34:06PM +, psychoticRabbit via
> Digitalmars-d-learn wrote: [...]
>
> > and what's going on here btw?
> >
> > assert( 1 == 1.01 ); // assertion error in DMD but not
>
On Mon, Feb 26, 2018 at 11:34:06PM +, psychoticRabbit via
Digitalmars-d-learn wrote:
[...]
> and what's going on here btw?
>
> assert( 1 == 1.01 ); // assertion error in DMD but not in
> LDC
> assert( 1 == 1.001 ); // no assertion error??
>
> (compiled in
On Sunday, 25 February 2018 at 14:52:19 UTC, Steven Schveighoffer
wrote:
1 == 1.0, no?
no. at least, not when a language forces you to think in terms of
types.
1 is an int.
1.0 is a floating point.
I admit, I've never printed output without using format
specifiers, but still, if I say
On Sunday, 25 February 2018 at 13:33:07 UTC, psychoticRabbit
wrote:
On Sunday, 25 February 2018 at 12:13:31 UTC, Andrea Fontana
wrote:
On Sunday, 25 February 2018 at 09:30:12 UTC, psychoticRabbit
wrote:
I would have preffered it defaulted java style ;-)
System.out.println(1.0); // i.e. it
On Sunday, 25 February 2018 at 13:33:07 UTC, psychoticRabbit
wrote:
can someone please design a language that does what I tell it!
please!!
is that so hard??
print 1.0 does not mean go and print 1 .. it means go and print
1.0
languages are too much like people.. always thinking for
On 2/25/18 8:33 AM, psychoticRabbit wrote:
On Sunday, 25 February 2018 at 12:13:31 UTC, Andrea Fontana wrote:
On Sunday, 25 February 2018 at 09:30:12 UTC, psychoticRabbit wrote:
I would have preffered it defaulted java style ;-)
System.out.println(1.0); // i.e. it prints 'what I told it to
On Sunday, 25 February 2018 at 12:13:31 UTC, Andrea Fontana wrote:
On Sunday, 25 February 2018 at 09:30:12 UTC, psychoticRabbit
wrote:
I would have preffered it defaulted java style ;-)
System.out.println(1.0); // i.e. it prints 'what I told it to
print'.
System.out.println(1.0); // print
On Sunday, 25 February 2018 at 09:30:12 UTC, psychoticRabbit
wrote:
I would have preffered it defaulted java style ;-)
System.out.println(1.0); // i.e. it prints 'what I told it to
print'.
System.out.println(1.0); // print 1.0
System.out.println(1.0); // print 1.0
So it doesn't print
On Sunday, 25 February 2018 at 08:46:19 UTC, rumbu wrote:
On Sunday, 25 February 2018 at 08:08:30 UTC, psychoticRabbit
wrote:
But umm what happended to the principle of least
astonishment?
writeln(1.1); (prints 1.1)
whereas..
writeln(1.0); (prints 1)
I don't get it. Cause it's
On Sunday, 25 February 2018 at 08:08:30 UTC, psychoticRabbit
wrote:
But umm what happended to the principle of least
astonishment?
writeln(1.1); (prints 1.1)
whereas..
writeln(1.0); (prints 1)
I don't get it. Cause it's 'nicer'??
Because writeln(someFloat) is equivalent to
On Sunday, 25 February 2018 at 06:35:07 UTC, Jonathan M Davis
wrote:
It's not printing ints. It's printing doubles. It's just that
all of the doubles have nothing to the right of the decimal
point, so they don't get printed with a decimal point. If you
did something like start with 1.1, then
On Sun, Feb 25, 2018 at 06:22:03AM +, psychoticRabbit via
Digitalmars-d-learn wrote:
[..]
> printArray(doubleArr); // why is it printing ints instead of doubles??
[...]
> void printArray(T)(const ref T[] a) if (isArray!(T[]))
> {
> foreach(t; a)
> writeln(t);
Try:
On Sunday, February 25, 2018 06:22:03 psychoticRabbit via Digitalmars-d-
learn wrote:
> On Sunday, 25 February 2018 at 05:40:19 UTC, Jonathan M Davis
>
> wrote:
> > int[] intArr = iota(1, 11).array();
> >
> > - Jonathan M Davis
>
> thanks!
>
>
On Sunday, 25 February 2018 at 06:22:03 UTC, psychoticRabbit
wrote:
On Sunday, 25 February 2018 at 05:40:19 UTC, Jonathan M Davis
wrote:
int[] intArr = iota(1, 11).array();
- Jonathan M Davis
thanks!
oh man. It's so easy to do stuff in D ;-)
But this leads me to a new problem now
On Sunday, 25 February 2018 at 05:40:19 UTC, Jonathan M Davis
wrote:
int[] intArr = iota(1, 11).array();
- Jonathan M Davis
thanks!
oh man. It's so easy to do stuff in D ;-)
But this leads me to a new problem now.
When I run my code below, I get ints printed instead of doubles
On Sunday, 25 February 2018 at 05:24:54 UTC, psychoticRabbit
wrote:
Hi. Anyone know whether something like this is possible?
I've tried various conversions/casts, but no luck yet.
Essentially, I want to cast the result set of the iota to an
array, during initialisation of the variable.
You
On Sunday, February 25, 2018 05:24:54 psychoticRabbit via Digitalmars-d-
learn wrote:
> Hi. Anyone know whether something like this is possible?
>
> I've tried various conversions/casts, but no luck yet.
>
> Essentially, I want to cast the result set of the iota to an
Hi. Anyone know whether something like this is possible?
I've tried various conversions/casts, but no luck yet.
Essentially, I want to cast the result set of the iota to an
array, during initialisation of the variable.
no, I don't want to use 'auto'. I want an array object
25 matches
Mail list logo