01:20:30 | * | redj joined #nim |
04:47:20 | * | ntat joined #nim |
04:55:06 | FromDiscord | <yottzumm> If I have an array of this type, how do I index into it? type↵ RArray[T] = object↵ len: int↵ data: ptr UncheckedArray[T] |
04:58:11 | FromDiscord | <yottzumm> I'm trying `var anims: RArray[ModelAnimation]↵ anims = loadModelAnimations("resources/JoeSkinTexcoordDisplacerKickUpdate2Export.gltf")↵ echo anims↵ echo anims.data |
04:58:44 | FromDiscord | <yottzumm> but I get the message: C:\Users\jcarl\assetmanager\skybox.nim(75, 13) Error: undeclared field: 'data' for type raylib.RArray [type declared in C:\Users\jcarl\.nimble\pkgs2\naylib-24.41-14ddf84cbfb248aabc7c9ff1cf1be35d32469937\raylib.nim(1816, 3)] |
05:06:27 | FromDiscord | <michaelb.eth> the `data` field doesn’t seem to be exported (public), otherwise it would be `data` in the type definition |
07:12:30 | FromDiscord | <spiderdave> sent a code paste, see https://play.nim-lang.org/#pasty=YegqdMAV |
07:13:40 | FromDiscord | <Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=TywaUNxH |
07:13:53 | FromDiscord | <Robyn [She/Her]> You should look at the tutorials |
07:14:36 | FromDiscord | <Robyn [She/Her]> Also, Nim has tuples too but there's no reason not to use an array, since Nim's array type doesn't change size once declared |
07:18:33 | * | ntat quit (Quit: Leaving) |
07:18:35 | FromDiscord | <spiderdave> https://i.imgur.com/tqAVFC3.png |
07:20:29 | FromDiscord | <Robyn [She/Her]> In reply to @spiderdave "https://i.imgur.com/tqAVFC3.png": i didn't say not to ask here, i said you should look at the tutorials as they'd provide useful info to you |
07:20:47 | FromDiscord | <spiderdave> k, i'd still like an answer to my question from someone willing to answer it |
07:21:02 | FromDiscord | <Robyn [She/Her]> i did answer it? |
07:21:52 | FromDiscord | <spiderdave> you responded, but didn't answer, i asked for how i could do that specific thing in nim |
07:22:48 | FromDiscord | <Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=WTieWXFZ |
07:22:55 | FromDiscord | <spiderdave> ? |
07:22:59 | FromDiscord | <Elegantbeef> Losing battle robyn |
07:23:06 | FromDiscord | <Robyn [She/Her]> that's the answer |
07:23:32 | FromDiscord | <Robyn [She/Her]> In reply to @Elegantbeef "Losing battle robyn": trying to give the benefit of doubt |
07:23:35 | FromDiscord | <spiderdave> oh, sorry i thought that was quoted |
07:23:42 | * | SchweinDeBurg quit (Quit: WeeChat 4.5.0-dev) |
07:23:52 | FromDiscord | <spiderdave> mb |
07:24:08 | FromDiscord | <Robyn [She/Her]> no sweat |
07:24:12 | FromDiscord | <spiderdave> i thought i tried, that i must've done something wrong |
07:25:36 | FromDiscord | <Robyn [She/Her]> In reply to @spiderdave "i thought i tried,": You probably tried `"foo" in ("foo", ...)` which doesn't work in Nim since tuples aren't iterable |
07:26:57 | * | SchweinDeBurg joined #nim |
08:28:04 | FromDiscord | <TӨMΛ ☠> sent a long message, see https://pasty.ee/KXUarHIs |
08:31:01 | FromDiscord | <TӨMΛ ☠> For context, I installed newest Nim and used finish.exe (including MinGW installation) and I'm trying to test `odsreader` lib - it requires `zip` lib (which isn't noted in their Nimble, so I will do the PR soonish adding that) but it seems like `zip` lib has some issues? |
08:31:25 | FromDiscord | <TӨMΛ ☠> (edit) "Nimble," => "nimble file," |
08:55:34 | FromDiscord | <k0ts> That line is just quoting the GCC command and stating that it failed |
08:55:44 | FromDiscord | <k0ts> Is the actual error message from GCC not shown above? |
09:23:05 | FromDiscord | <TӨMΛ ☠> sent a long message, see https://pasty.ee/MetpLzbC |
09:23:54 | Amun-Ra | zip nimble package requires zlib dev files |
09:49:00 | om3ga | Hello all! https://play.nim-lang.org/#pasty=mATqcTpx is this a bug? |
09:50:00 | om3ga | Nim Compiler Version 2.0.4 [MacOSX: amd64] Compiled at 2024-04-25 |
09:52:56 | Amun-Ra | you mean 8.044499999999999? |
09:53:05 | Amun-Ra | om3ga: no, that's how floating point numbers work |
09:53:20 | * | PMunch joined #nim |
09:53:57 | om3ga | Amun-Ra: https://onlinegdb.com/kJd5Ho5X7 |
09:56:02 | Amun-Ra | hmm, I can't connect to onlinegdb |
09:56:25 | om3ga | let me share using another online compiler |
09:56:35 | Amun-Ra | but if you turned nimPreviewSlimSystem on, you have to import std/formatfloat |
09:58:11 | om3ga | https://nextleap.app/online-compiler/c-programming/7rsayi44f |
09:58:42 | FromDiscord | <k0ts> See also `-d:nimPreviewFloatRoundtrip` which recently become the default on devel |
09:58:52 | FromDiscord | <k0ts> (edit) "become" => "became" |
09:59:22 | om3ga | I understand all about rounding errors, but if this non mutable variable is like that during assignment, this isn't good |
10:00:29 | om3ga | k0ts interesting, but anyway, I don't think that such behaviour is ok |
10:06:17 | Amun-Ra | what do you mean? |
10:06:25 | Amun-Ra | you can't store 8.0045 directly |
10:06:30 | FromDiscord | <k0ts> 8.0445 cannot be represented exactly in floating point, so 8.0449999... is the best you can get |
10:06:43 | Amun-Ra | the value stored is really 8.04449999999999931788 |
10:07:05 | Amun-Ra | you see 8.0446 printed because of rounding during the print |
10:07:08 | FromDiscord | <k0ts> Some programming languages, now including Nim, choose to display it as 8.0445 so it looks better, even though that isn't the actual value stored |
10:07:25 | Amun-Ra | om3ga: https://float.exposed/0x402016c8b4395810 |
10:07:34 | Amun-Ra | try to enter 8.0446 there |
10:08:05 | FromDiscord | <k0ts> (edit) "8.0449999..." => "8.04449999..." |
10:08:30 | Amun-Ra | as I was saying, that's how floating point numbers work |
10:09:02 | Amun-Ra | you can't have 0.3 either :) |
10:09:13 | Amun-Ra | https://float.exposed/0x3fd3333333333333 |
10:10:29 | Amun-Ra | "let val = 8.0445" in nim stores exactly the same value as C "double FloatNumber = 8.0445;" the difference is only in print code |
10:10:44 | om3ga | so that's misleading |
10:10:45 | om3ga | 8.044500 |
10:10:47 | Amun-Ra | (tbh it can differ one value up or down) |
10:11:02 | om3ga | this what prints code in C |
10:11:07 | Amun-Ra | float64 can't store 8.044500 |
10:11:20 | Amun-Ra | printf rouds the value |
10:12:32 | om3ga | https://nextleap.app/online-compiler/c-programming/dntiqqgy1 |
10:12:42 | om3ga | this is 64 bit float with C |
10:12:58 | om3ga | printf prints properly |
10:13:22 | Amun-Ra | you. cannot. store. 8.0445. in. double. |
10:14:00 | om3ga | I understand. how you explain C code? |
10:14:38 | Amun-Ra | look at the printf implementation |
10:14:48 | om3ga | that's what I'm saying |
10:15:41 | om3ga | should in this case echo print the value as printf does? |
10:16:11 | Amun-Ra | tbh I'd like to have the value printed as close to the original value as possible |
10:17:19 | om3ga | Today, my colleague has asked me to explain why the calculated results do not match. |
10:18:23 | om3ga | I don't know how to explain him rounding errors, and why this number cannot be stored exactly like was assigned, because even I forgot the nuances |
10:26:58 | om3ga | Amun-Ra: thank you, import std/formatfloat <- this works |
10:27:19 | om3ga | but still, in my opinion that should be on by default |
10:37:13 | Amun-Ra | hmm, I almost always print floats with specific numer of digits after '.' (fmt"{foo:.4}" etc.) |
10:41:59 | om3ga | Amun-Ra: Colleagues' wishes are important, if you know what I mean :) |
10:42:08 | Amun-Ra | mhm ;> |
10:43:25 | FromDiscord | <ringabout> It already prints `8.0445` by default on the devel branch |
10:43:42 | FromDiscord | <ringabout> https://github.com/nim-lang/Nim/pull/24300 |
10:44:14 | FromDiscord | <ringabout> since https://github.com/nim-lang/Nim/pull/24217 |
10:45:17 | om3ga | ringabout, I hope this will be added to next stable release |
10:50:50 | om3ga | danm I have old version here |
11:36:05 | FromDiscord | <ayex> sent a long message, see https://pasty.ee/uUbzNIII |
11:37:04 | FromDiscord | <ayex> ah ok, the have that issue already in the tracker. #140 |
11:45:51 | FromDiscord | <TӨMΛ ☠> In reply to @Amun-Ra "zip nimble package requires": How can I fix that then? 😣 I wish the lib didn't use `zip`, it gives me so much trouble |
11:47:08 | FromDiscord | <k0ts> In reply to @ayex "anyone else has this": I had that a while back, fixed after recompiling latest inim with latest nim |
11:47:49 | FromDiscord | <ayex> latest stable or latest dev? |
11:48:36 | FromDiscord | <k0ts> Latest devel at the time but that was a while ago |
11:51:01 | FromDiscord | <ayex> ah ok. thx |
11:56:48 | FromDiscord | <ringabout> In reply to @ayex "anyone else has this": It's a bug of its dependency |
11:56:50 | FromDiscord | <ringabout> https://github.com/jangko/nim-noise/pull/35 |
12:00:41 | FromDiscord | <ayex> [ringabout](https://matrix.to/#/%40_discord_658563905425244160%3At2bot.io) \: thank you for the explanation and link on issue. 🙂 |
12:01:12 | FromDiscord | <ringabout> np |
12:32:35 | * | beholders_eye joined #nim |
12:49:03 | * | ntat joined #nim |
12:55:57 | * | Deadm0th quit (Quit: Twój stary) |
13:05:52 | FromDiscord | <xtrayambak> In reply to @Amun-Ra "you can't have 0.3": 0.1 + 0.2 is an interesting one too |
14:18:47 | * | lucasta joined #nim |
14:24:31 | FromDiscord | <demotomohiro> If you want to learn how floating point numvbe |
14:25:21 | FromDiscord | <demotomohiro> If you want to learn how floating point numbers work, search for ieee754. |
14:37:43 | PMunch | Hmm, no varargs[openArray]? Any way to work around this? |
14:48:43 | PMunch | `toOpenArray("", 0, -1)`, this feels very cursed, is there a better way to create an openArray of len 0? |
14:49:00 | FromDiscord | <leorize> `[]` |
14:49:03 | PMunch | (Trying to have an optional argument and want to default to an empty one) |
14:49:08 | PMunch | Doesn't work |
14:49:39 | PMunch | Oh wait, if I explicitly type `toOpenArray` then it works |
14:50:17 | FromDiscord | <leorize> maybe be explicit and go `array[0, T]([])`? |
14:50:29 | FromDiscord | <leorize> kinda weird that it doesn't work, though |
14:50:55 | * | ntat_ joined #nim |
14:51:05 | PMunch | `toOpenArray[char]([], 0, -1)` works |
14:51:39 | * | ntat quit (Ping timeout: 260 seconds) |
14:51:46 | * | ntat_ quit (Remote host closed the connection) |
14:52:08 | * | ntat_ joined #nim |
14:52:24 | PMunch | Unfortunately creates a length 1 array to grab a pointer to though.. |
14:53:37 | PMunch | Aha! `toOpenArray(cast[ptr UncheckedArray[char]](nil), 0, -1)` |
14:54:41 | FromDiscord | <leorize> that's the most cursed thing I've seen |
14:55:57 | PMunch | Haha, yeah it's not great is it.. |
14:58:04 | FromDiscord | <leorize> usually I managed to just use `[]` so it's weird that you need the dance |
15:02:50 | PMunch | Well it worked with `toOpenArray[char]([], 0, -1)` |
15:02:56 | PMunch | But it created more code than I wanted |
15:15:09 | FromDiscord | <leorize> I mean usually I don't even need toOpenArray |
15:18:56 | PMunch | Oh shit, that works.. |
15:20:44 | PMunch | Same file size and everything.. |
15:24:13 | PMunch | I just assumed that Nim wouldn't be smart enough to handle that. Silly me |
15:31:56 | Amun-Ra | wait, toOpenArray[char]([], 0, -1) that's legal? |
15:35:15 | FromDiscord | <leorize> nim is dumb but not that dumb |
15:51:08 | * | PMunch quit (Quit: Leaving) |
15:58:40 | * | beholders_eye quit (Ping timeout: 252 seconds) |
15:59:36 | * | beholders_eye joined #nim |
16:03:09 | FromDiscord | <buwubie> sent a long message, see https://pasty.ee/adFAbGBa |
16:07:59 | FromDiscord | <leorize> it's more that an operator can only be used as an operator in either unary or binary mode |
16:08:38 | FromDiscord | <leorize> so `a $$ b` would work, I believe |
16:09:02 | FromDiscord | <buwubie> Oh, ok, thank you |
16:09:04 | Amun-Ra | buwubie: https://play.nim-lang.org/#pasty=noaISdGg |
16:09:11 | FromDiscord | <leorize> but if you want to pass in more than 2 parameters then you can't do it using operator syntax |
16:09:20 | FromDiscord | <leorize> you must call it like a function |
16:09:43 | Amun-Ra | and if function returns a value () are mandatory |
16:12:29 | FromDiscord | <buwubie> So i should replace the operator with a named proc |
16:13:37 | Amun-Ra | that's a good idea |
16:15:40 | * | lucasta quit (Quit: Leaving) |
16:16:00 | FromDiscord | <buwubie> Thank you very much |
16:43:45 | * | beholders_eye quit (Ping timeout: 252 seconds) |
18:43:19 | * | Artea quit (Ping timeout: 264 seconds) |
19:06:04 | * | Artea joined #nim |
19:15:41 | * | Artea quit (Quit: ZNC 1.8.2 - https://znc.in) |
19:20:33 | * | Artea joined #nim |
19:57:34 | * | ntat_ quit (Quit: Leaving) |
20:45:44 | * | rockcavera joined #nim |
23:55:53 | FromDiscord | <spotlightkid> @ringabout\: choosnim's https://nim-lang.org/choosenim/init.sh needs to be updated to the latest version in the repo. It is missing the latest changes in [commit ac77dc5 "supports arm64 on macOS" ](https://github.com/nim-lang/choosenim/commit/fc240acbcfaff5fe8f3eda4bcf5fbafe84a86add). |
23:58:23 | FromDiscord | <spotlightkid> @ringabout\: choosenim's https://nim-lang.org/choosenim/init.sh needs to be updated to the latest version in the repo. It is missing the latest changes in [commit ac77dc5 "supports arm64 on macOS" ](https://github.com/nim-lang/choosenim/commit/fc240acbcfaff5fe8f3eda4bcf5fbafe84a86add). |