9999999999999999.0 – 9999999999999998.0

2024-01-11 Thread jasonfi
The reason I posted, was to link from HN to this forum, to give the community a little boost. I'm not alarmed by this.

9999999999999999.0 – 9999999999999998.0

2024-01-11 Thread jasonfi
I did wonder if the fault wasn't at a lower level, but then Perl 6 and Wolfram both got the right answer. No need for the snarky reply.

9999999999999999.0 – 9999999999999998.0

2024-01-11 Thread giaco
This just proves that you don't know how a float works inside your CPU

9999999999999999.0 – 9999999999999998.0

2024-01-11 Thread auxym
Nim doesn't "fail", Nim uses machine native floats by default (double precision to be exact) and your your CPU conforms to the IEEE 754 spec for floats. Therefore, this result is expected. > What Every Computer Scientist Should Know About Floating-Point Arithmetic : >

9999999999999999.0 – 9999999999999998.0

2024-01-11 Thread Isofruit
Just to emphasize what auxym just stated: Your browser will fuck this up as well because JS does not have integers, its "number" type is all floats. Which is why your browser is incapable of handling really large numbers like that unless you start using BigInt. If you want to test this out, ope

9999999999999999.0 – 9999999999999998.0

2024-01-11 Thread morturo
it works with decimal but not with floats import decimal/decimal let a = newDecimal(".0") let b = newDecimal("9998.0") echo a - b Run

9999999999999999.0 – 9999999999999998.0

2024-01-11 Thread jasonfi
I found this programming language challenge on HN: Nim v2.0.2 fails at this, giving 2.0 as the answer. var c = .0 - 9998.0 echo $c Run I tried giving c type float64, but the answer is the

Custom constructors

2024-01-11 Thread lim1999
Thanks for all the replies so far. It really helped me to reason about Nim. However, at this point I'm even more convinced of the point I was trying to make I will play a bit more with Nim to figure out how to best lay out my thoughts in favor of a python like __init__

Custom constructors

2024-01-11 Thread lim1999
When I wrote constructors, what I actually had in mind was an initialization proc like in the __init__ method in python. Thanks for pointing out the subtle difference. That would suffice to tailor the initialization of member of objects or, as it was the case in my example, the kind of alias to

Custom constructors

2024-01-11 Thread lim1999
Thanks. I agree d = 176.toDollar Run reads better. I'm fine with that. But the issue remains: since the language allows d = 176.Dollar Run users of such module might be tempted to use it and get the unintended result. But I get it, this is how t

Smart Hemp Gummies AU Scientist Distribution center CBD Gummies!

2024-01-11 Thread revieyt
Shrewd Smart Hemp Gummies AU (Scientist Distribution center CBD Gummies AU Uncovered) Should Peruse and Purchase! Smart Hemp Gummies AU:- Working, Advantages and that's only the tip of the iceberg. ✅ ⇒ Cost (for Front) Purchase Now ⇒ Snap Here✅ ✅ Click Here To CBD Gummies Australia - "OFFICIAL

Custom constructors

2024-01-11 Thread awr1
> It would be nice to be able to at least disable default constructors. We have > various hooks now, so it seems it'd be a natural extension from there. > There's just some cases when a default object constructor needs to be > disabled or overridden. what about `{.requiresInit.}`?

Custom constructors

2024-01-11 Thread elcritch
> I tried to study about constructors in C++ before and I found that there are > many complex rules in C++ constructor. > I used to not miss constructors as `newObj` or `new[T]` both work fine. However, recently I've seen a couple of bugs

Custom constructors

2024-01-11 Thread elcritch
I haven't checked but I wouldn't be surprised if there wasn't a couple of RFC's for this.