Nim programming language forum post activityhttps://forum.nim-lang.org/2024-03-28T07:57:48ZCross compilation to Windows, linker error (unrecognized option '-z'urn:entry:738422024-03-28T07:57:48Z2024-03-28T07:57:48ZscippieOn 2024-03-28 07:57:48, scippie said:
<p>
<div><span>
</span><blockquote><p><span> </span><span>But it seems to not be the case. I now think it's one of your dependencies that adds it.</span></p></blockquote><p><span>Are you talking about the imports I use? Because I find it strange that they would influence the compiler arguments. Anyway, to prove that it doesn't have to do with that, I made a simple hello world and it gives the same error.</span></p><span>
</span><p><pre data-lang="none" class="code"><code>
$ cat test.nim
echo "Hello world!"
$ nim c -d:mingw test.nim
Hint: used config file '/etc/nim/nim.cfg' [Conf]
Hint: used config file '/etc/nim/config.nims' [Conf]
........................................................................
CC: ../../../../usr/lib/nim/system/exceptions.nim
CC: ../../../../usr/lib/nim/std/private/digitsutils.nim
CC: ../../../../usr/lib/nim/system/dollars.nim
CC: ../../../../usr/lib/nim/std/exitprocs.nim
CC: ../../../../usr/lib/nim/std/syncio.nim
CC: ../../../../usr/lib/nim/system.nim
CC: test.nim
Hint: [Link]
/usr/lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld: unrecognized option '-z'
/usr/lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld: use the --help option for usage information
collect2: error: ld returned 1 exit status
Error: execution of an external program failed: '/usr/bin/x86_64-w64-mingw32-gcc -o /home/dirk/projects/nim-opengl/test.exe /home/dirk/.cache/nim/test_d/@m..@s..@s..@s..@susr@slib@snim@ssystem@sexceptions.nim.c.o /home/dirk/.cache/nim/test_d/@m..@s..@s..@s..@susr@slib@snim@sstd@sprivate@sdigitsutils.nim.c.o /home/dirk/.cache/nim/test_d/@m..@s..@s..@s..@susr@slib@snim@ssystem@sdollars.nim.c.o /home/dirk/.cache/nim/test_d/@m..@s..@s..@s..@susr@slib@snim@sstd@sexitprocs.nim.c.o /home/dirk/.cache/nim/test_d/@m..@s..@s..@s..@susr@slib@snim@sstd@ssyncio.nim.c.o /home/dirk/.cache/nim/test_d/@m..@s..@s..@s..@susr@slib@snim@ssystem.nim.c.o /home/dirk/.cache/nim/test_d/@mtest.nim.c.o -Wl,-Bstatic -lpthread -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'
</code><div class="code-buttons"><button class="btn btn-primary btn-sm">Run</button></div></pre></p><span>
</span><p><span>Adding your earlier suggested arguments doesn't help either. </span></p></div>Cross compilation to Windows, linker error (unrecognized option '-z'urn:entry:738412024-03-28T07:57:07Z2024-03-28T07:57:07ZscippieOn 2024-03-28 07:57:07, scippie said:
<p>
<div><span>
</span><blockquote><p><span> </span><span>Out of curiosity, what happens when you add two more flags: --cpu:amd64 and --os:windows?</span></p></blockquote><p><span>Very strange, that makes it use gcc instead of mingw (although I specified the d:mingw option) which doesn't work of course. The errors shown are that it can't find io.h and windows.h, but the last line says:</span></p><span>
</span><p><pre data-lang="none" class="code"><code>
Error: execution of an external compiler program 'gcc -c -w -fmax-errors=3 -mno-ms-bitfields -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -DWIN32_LEAN_AND_MEAN -I/usr/lib/nim/lib -I/home/dirk/projects/nim-opengl -o /home/dirk/.cache/nim/main_d/@m..@s..@s..@s..@susr@slib@snim@sstd@ssyncio.nim.c.o /home/dirk/.cache/nim/main_d/@m..@s..@s..@s..@susr@slib@snim@sstd@ssyncio.nim.c' failed with exit code: 1
</code><div class="code-buttons"><button class="btn btn-primary btn-sm">Run</button></div></pre><span> </span></p></div>Stylus: a CSS3 parser and tokenizer written in pure Nim (and a small update on Ferus)urn:entry:738402024-03-28T06:25:33Z2024-03-28T06:25:33ZxTrayambakOn 2024-03-28 06:25:33, xTrayambak said:
<p>
<div><p><span>Hey everyone, I've been working on a CSS parser for a month at this point (perhaps more). It aims to cover the entire CSS3 specification and it's mostly based off of Servo's </span><tt class="docutils literal"><span class="pre">cssparser</span></tt><span> </span><span>library. The tokenizer is mostly completed at this point and the parser is also nearly done. If anyone wants to have a look, here you go: </span><a class="reference external" href="https://github.com/ferus-web/stylus">https://github.com/ferus-web/stylus</a></p><span>
</span><p><span>I'll now be working on getting </span><tt class="docutils literal"><span class="pre">ferusgfx</span></tt><span> </span><span>integrated into the Ferus codebase, replacing the old renderer.</span></p></div>Glaucus Linuxurn:entry:738392024-03-28T05:50:06Z2024-03-28T05:50:06ZtermerOn 2024-03-28 05:50:06, termer said:
<p>
<span>I like the Terry quote on the website</span>Cross compilation to Windows, linker error (unrecognized option '-z'urn:entry:738382024-03-28T05:43:22Z2024-03-28T05:43:22Zsls1005On 2024-03-28 05:43:22, sls1005 said:
<p>
<div><blockquote><p><span>but I am working on Linux</span></p></blockquote><span>
</span><p><span>When you cross-compile, you use the special linker (the one shipped with mingw) for Windows, rather than the one you used to use on Linux.</span></p><span>
</span><blockquote><p><span>Also, if -z is not supported (on mingw), why does the Nim compiler use it (when asking it to specifically compile for Windows with mingw)?</span></p></blockquote><span>
</span><p><span>Some platforms ship the Nim compiler with a modified version of config files. (which was why I suggested redefining the additional options to empty.) But it seems to not be the case. I now think it's one of your dependencies that adds it.</span></p></div>Logarithm Implementation Tutorialurn:entry:738372024-03-28T03:54:57Z2024-03-28T03:54:57ZjackhftangOn 2024-03-28 03:54:57, jackhftang said:
<p>
<div><span>To be honest,</span><ol class="simple"><li><span>There is no need to compute </span><tt class="docutils literal"><span class="pre">pow(E, result)</span></tt><span> </span><span>twice.</span></li><span>
</span><li><span>A fast numerical way should use polynomial approximation. see </span><a class="reference external" href="https://git.musl-libc.org/cgit/musl/tree/src/math/log.c">musl implementation</a></li><span>
</span><li><tt class="docutils literal"><span class="pre">pow</span></tt><span> </span><span>should not be used, not to say inside while loop. Also, implementation of </span><tt class="docutils literal"><span class="pre">pow</span></tt><span> </span><span>often calls </span><tt class="docutils literal"><span class="pre">log</span></tt><span> </span><span>internally.</span></li><span>
</span><li><span>Newton method is a fast method (the approximation speed is linear to accuracy per iteration), but it doesn't mean direct implementation is fast.</span></li><span>
</span><li><span>A simple binary search (the approximation speed is constant per iteration) is possible by making use of some basic properties </span><tt class="docutils literal"><span class="pre">log2(x) = 1+log2(x/2) = log2(x*x)/2</span></tt><span>, no external library needed, no table lookup needed, no special constant needed.</span></li><span>
</span></ol><span>
</span><p><pre data-lang="Nim" class="code"><code><span class="Keyword">import</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Identifier">monotimes</span>
<span class="Keyword">from</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Identifier">math</span> <span class="Keyword">import</span> <span class="Identifier">pow</span><span class="Punctuation">,</span> <span class="Identifier">almostEqual</span><span class="Punctuation">,</span> <span class="Identifier">E</span><span class="Punctuation">,</span> <span class="Identifier">log2</span>
<span class="Keyword">from</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Identifier">fenv</span> <span class="Keyword">import</span> <span class="Identifier">epsilon</span>
<span class="Keyword">proc</span> <span class="Identifier">simpleNewton</span><span class="Punctuation">(</span><span class="Identifier">n</span><span class="Punctuation">:</span> <span class="Identifier">float64</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">float64</span> <span class="Operator">=</span>
<span class="Keyword">var</span> <span class="Identifier">next</span><span class="Punctuation">:</span> <span class="Identifier">float64</span> <span class="Operator">=</span> <span class="FloatNumber">1.0</span>
<span class="Keyword">while</span> <span class="Keyword">not</span> <span class="Identifier">almostEqual</span><span class="Punctuation">(</span><span class="Identifier">result</span><span class="Punctuation">,</span> <span class="Identifier">next</span><span class="Punctuation">,</span> <span class="DecNumber">1</span><span class="Punctuation">)</span><span class="Punctuation">:</span>
<span class="Identifier">result</span> <span class="Operator">=</span> <span class="Identifier">next</span>
<span class="Identifier">next</span> <span class="Operator">=</span> <span class="Identifier">result</span> <span class="Operator">-</span> <span class="DecNumber">1</span> <span class="Operator">+</span> <span class="Identifier">n</span><span class="Operator">/</span><span class="Identifier">pow</span><span class="Punctuation">(</span><span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="Identifier">result</span><span class="Punctuation">)</span>
<span class="Keyword">proc</span> <span class="Identifier">binarySearch</span><span class="Punctuation">(</span><span class="Identifier">n</span><span class="Punctuation">:</span> <span class="Identifier">float64</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">float64</span> <span class="Operator">=</span>
<span class="Keyword">var</span> <span class="Identifier">x</span> <span class="Operator">=</span> <span class="Identifier">n</span>
<span class="Keyword">var</span> <span class="Identifier">c</span> <span class="Operator">=</span> <span class="FloatNumber">1.0</span>
<span class="Keyword">while</span> <span class="Identifier">c</span> <span class="Operator">></span> <span class="Identifier">epsilon</span><span class="Punctuation">(</span><span class="Identifier">float64</span><span class="Punctuation">)</span><span class="Punctuation">:</span>
<span class="Keyword">if</span> <span class="Identifier">x</span> <span class="Operator">>=</span> <span class="DecNumber">2</span><span class="Punctuation">:</span>
<span class="Identifier">result</span> <span class="Operator">+=</span> <span class="Identifier">c</span>
<span class="Identifier">x</span> <span class="Operator">/=</span> <span class="DecNumber">2</span>
<span class="Keyword">elif</span> <span class="Identifier">x</span> <span class="Operator"><=</span> <span class="DecNumber">1</span><span class="Operator">/</span><span class="DecNumber">2</span><span class="Punctuation">:</span>
<span class="Identifier">result</span> <span class="Operator">-=</span> <span class="Identifier">c</span>
<span class="Identifier">x</span> <span class="Operator">*=</span> <span class="DecNumber">2</span>
<span class="Keyword">else</span><span class="Punctuation">:</span>
<span class="Identifier">x</span> <span class="Operator">=</span> <span class="Identifier">x</span><span class="Operator">*</span><span class="Identifier">x</span>
<span class="Identifier">c</span> <span class="Operator">/=</span> <span class="DecNumber">2</span>
<span class="Keyword">var</span> <span class="Identifier">t0</span> <span class="Operator">=</span> <span class="Identifier">high</span><span class="Punctuation">(</span><span class="Identifier">int</span><span class="Punctuation">)</span>
<span class="Keyword">template</span> <span class="Identifier">timeit</span><span class="Punctuation">(</span><span class="Identifier">name</span><span class="Punctuation">,</span> <span class="Identifier">code</span><span class="Punctuation">)</span> <span class="Operator">=</span>
<span class="Keyword">block</span><span class="Punctuation">:</span>
<span class="Keyword">let</span> <span class="Identifier">s</span> <span class="Operator">=</span> <span class="Identifier">getMonoTime</span><span class="Punctuation">(</span><span class="Punctuation">)</span>
<span class="Keyword">var</span> <span class="Identifier">ans</span> <span class="Operator">=</span> <span class="FloatNumber">0.0</span>
<span class="Keyword">for</span> <span class="Identifier">i</span> <span class="Keyword">in</span> <span class="FloatNumber">1.</span><span class="Operator">.</span><span class="DecNumber">1000</span><span class="Punctuation">:</span>
<span class="Identifier">ans</span> <span class="Operator">+=</span> <span class="Identifier">code</span><span class="Punctuation">(</span><span class="Identifier">i</span><span class="Operator">.</span><span class="Identifier">float</span><span class="Punctuation">)</span>
<span class="Keyword">let</span> <span class="Identifier">e</span> <span class="Operator">=</span> <span class="Identifier">getMonoTime</span><span class="Punctuation">(</span><span class="Punctuation">)</span>
<span class="Keyword">let</span> <span class="Identifier">t</span> <span class="Operator">=</span> <span class="Identifier">e</span><span class="Operator">.</span><span class="Identifier">ticks</span> <span class="Operator">-</span> <span class="Identifier">s</span><span class="Operator">.</span><span class="Identifier">ticks</span>
<span class="Identifier">t0</span> <span class="Operator">=</span> <span class="Identifier">min</span><span class="Punctuation">(</span><span class="Identifier">t0</span><span class="Punctuation">,</span> <span class="Identifier">t</span><span class="Punctuation">)</span>
<span class="Comment"># echo t</span>
<span class="Identifier">echo</span> <span class="Identifier">name</span><span class="Punctuation">,</span> <span class="StringLit">": time="</span><span class="Punctuation">,</span> <span class="Identifier">t</span><span class="Punctuation">,</span> <span class="StringLit">"</span><span class="EscapeSequence">\t</span><span class="StringLit">(x"</span><span class="Punctuation">,</span> <span class="Identifier">t</span><span class="Operator">/</span><span class="Identifier">t0</span><span class="Punctuation">,</span> <span class="StringLit">")</span><span class="EscapeSequence">\t</span><span class="StringLit">ans="</span><span class="Punctuation">,</span> <span class="Identifier">ans</span>
<span class="Identifier">timeit</span> <span class="StringLit">"math.log2 "</span><span class="Punctuation">,</span> <span class="Identifier">log2</span>
<span class="Identifier">timeit</span> <span class="StringLit">"binarySearch"</span><span class="Punctuation">,</span> <span class="Identifier">binarySearch</span>
<span class="Identifier">timeit</span> <span class="StringLit">"simpleNewton"</span><span class="Punctuation">,</span> <span class="Identifier">simpleNewton</span>
<span class="Comment"># nim r -d:release play_log.nim</span>
<span class="Comment"># math.log : time=28050 (x1.0) ans=8529.398004204777</span>
<span class="Comment"># binarySearch: time=762358 (x27.17853832442068) ans=8529.398004204777</span>
<span class="Comment"># simpleNewton: time=16559248 (x590.34752228164) ans=8529.398004204781</span>
</code><div class="code-buttons"><button class="btn btn-primary btn-sm">Run</button></div></pre></p><span>
</span><ol start="6" class="simple"><li><span>The way calculating </span><tt class="docutils literal"><span class="pre">result</span></tt><span> </span><span>in simpleNewton </span><strong><span>may</span></strong><span> </span><span>accumulates and propagates numerical error sightly higher than the others as shown above.</span></li><span>
</span></ol></div>What is Biopeak Male Enhancement?urn:entry:738362024-03-27T18:59:45Z2024-03-27T18:59:45ZpaneertikkaOn 2024-03-27 18:59:45, paneertikka said:
<p>
<div><p><span>Biopeak Male Enhancement Reviews - Effective Ingredients or Dangerous Side Effects Risk? Biopeak Male Enhancement Outline: In the journey for top male execution and imperativeness, people frequently go to supplements that guarantee to upgrade their virility and by and large sexual prosperity. Bio Pinnacle Male Upgrade is one such enhancement that has acquired consideration for its capability to work on sexual wellbeing and give different benefits to men. In this thorough aide, we will investigate what Bio Pinnacle Male Upgrade is, the means by which it works, its key fixings, the potential advantages it offers, any related secondary effects, appropriate utilization rules, and how to secure this enhancement. By and by, you'll have a careful comprehension of whether Biopeak Male Enhancement may be the way to opening your maximum capacity.</span></p><span>
</span><p><span>►►Click Here To Order Biopeak Male Enhancement Now!◄◄ </span><a class="reference external" href="https://humanselixir.com/Truman">https://humanselixir.com/Truman</a></p><span>
</span><p><span>What is Biopeak Male Improvement? Biopeak Male Upgrade is a characteristic enhancement reasonable for men of different ages. Venders guarantee it's the top decision for boosting male strength in the present market. Its viability originates from its normal fixings, each offering medical advantages. This supplement tends to weakness, supports endurance, and works on sexual execution. For those looking for a superior sexual coexistence, it's an incredible choice.</span></p><span>
</span><p><span>Advantage of Biopeak Male Upgrade? Biopeak Male Improvement offers various medical advantages, principally zeroing in on working on sexual encounters. Investigate the advantages framed beneath: • The enhancement empowers longer-enduring erections, improving satisfaction with your accomplice in bed. • Its fixings and equation normally improve penis size, giving a predictable lift in blood stream to add more crawls to your </span><span>"</span><span>weapon.</span><span>"</span><span> </span><span>• Biopeak Male Upgrade helps endurance, permitting you to play a more dynamic job with your accomplice. • With this enhancement, you'll encounter expanded certainty during sex with your female accomplice.</span></p><span>
</span><p><span>►►Click Here To Order Biopeak Male Enhancement Now!◄◄ </span><a class="reference external" href="https://humanselixir.com/Truman">https://humanselixir.com/Truman</a></p><span>
</span><p><span>How does Biopeak Male Improvement function? This item is formed from regular fixings found in the climate, which quickly increments nitric oxide levels in the blood and detoxifies it. Biopeak Male Upgrade bridles the force of regular dynamic fixings removed from fundamental plants and spices. Clients will see their muscles feeling more invigorated and strong once they begin taking this enhancement. With its believed fixings, Biopeak Male Improvement guarantees a solid drive with next to no unfavorable impacts. It forestalls untimely discharge or ineptitude during intercourse, guaranteeing sexual wellness and giving more than adequate endurance. Besides, Male Improvement supports testosterone and endorphin creation in the body, vital for keeping a powerful moxie.</span></p><span>
</span><p><span>Is Biopeak Male Improvement protected to consume? The maker states that Biopeak Male Improvement makes no revealed side impacts. It's created after intensive exploration and is specialist suggested. Every one of the all-normal fixings in this supplement goes through thorough wellbeing and viability testing prior to being utilized underway. Therefore, this supplement is considered safe for use.</span></p><span>
</span><p><span>Last Thought - Prior to Purchasing: Biopeak Male Upgrade reestablishes endurance, power, and sexual craving to clients who might need them in their sexual experiences. It has demonstrated advantageous for some men, giving them the fundamental devices to improve execution with their accomplices. The main disadvantage of this item is its expense. Regardless, it merits putting resources into in light of the fact that Biopeak Male Upgrade guarantees no aftereffects from abuse, in contrast to other comparable enhancements.</span></p><span>
</span><p><span>►►Click Here To Order Biopeak Male Enhancement Now!◄◄ </span><a class="reference external" href="https://humanselixir.com/Truman">https://humanselixir.com/Truman</a></p><span>
</span><p><a class="reference external" href="https://groups.google.com/g/biopeak-male-enhancements/c/dQ_u80N4l8w">https://groups.google.com/g/biopeak-male-enhancements/c/dQ_u80N4l8w</a><span> </span><a class="reference external" href="https://groups.google.com/g/biopeak-male-enhancements/c/z4XoMxdG7Ks">https://groups.google.com/g/biopeak-male-enhancements/c/z4XoMxdG7Ks</a><span> </span><a class="reference external" href="https://community.bt.com/t5/ADSL-Copper-broadband/Biopeak-Male-Enhancement-Reviews-Scam-OR-Legit-Shark-Tank/td-p/2358657">https://community.bt.com/t5/ADSL-Copper-broadband/Biopeak-Male-Enhancement-Reviews-Scam-OR-Legit-Shark-Tank/td-p/2358657</a><span> </span><a class="reference external" href="https://community.bt.com/t5/Broadband-Extras-Apps-from-BT/Biopeak-Male-Enhancement-Reviews-Does-It-Work-What-They-Won-t/td-p/2358659">https://community.bt.com/t5/Broadband-Extras-Apps-from-BT/Biopeak-Male-Enhancement-Reviews-Does-It-Work-What-They-Won-t/td-p/2358659</a></p></div>Logarithm Implementation Tutorialurn:entry:738352024-03-27T17:51:47Z2024-03-27T17:51:47ZNlitsOn 2024-03-27 17:51:47, Nlits said:
<p>
<div><p><span>I was working on a project, got distracted, and somehow ended up making a tutorial on how to implement logBASE in pure nim. (The link is </span><a class="reference external" href="https://logarithm-implementation-in-nim.pages.dev/release/">here</a><span>)</span></p><span>
</span><p><span>The end result is this:</span></p><span>
</span><p><pre data-lang="Nim" class="code"><code><span class="Keyword">from</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Identifier">math</span> <span class="Keyword">import</span> <span class="Identifier">pow</span><span class="Punctuation">,</span> <span class="Identifier">almostEqual</span><span class="Punctuation">,</span> <span class="Identifier">E</span>
<span class="Keyword">proc</span> <span class="Identifier">ln</span><span class="Punctuation">(</span><span class="Identifier">n</span><span class="Punctuation">:</span> <span class="Identifier">float64</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">float64</span> <span class="Operator">=</span>
<span class="Keyword">var</span> <span class="Identifier">next</span><span class="Punctuation">:</span> <span class="Identifier">float64</span> <span class="Operator">=</span> <span class="FloatNumber">1.0</span>
<span class="Keyword">while</span> <span class="Keyword">not</span> <span class="Identifier">almostEqual</span><span class="Punctuation">(</span><span class="Identifier">result</span><span class="Punctuation">,</span> <span class="Identifier">next</span><span class="Punctuation">,</span> <span class="DecNumber">1</span><span class="Punctuation">)</span><span class="Punctuation">:</span>
<span class="Identifier">result</span> <span class="Operator">=</span> <span class="Identifier">next</span>
<span class="Identifier">next</span> <span class="Operator">=</span> <span class="Identifier">result</span> <span class="Operator">-</span> <span class="Punctuation">(</span><span class="Punctuation">(</span><span class="Identifier">pow</span><span class="Punctuation">(</span><span class="Identifier">E</span><span class="Punctuation">,</span> <span class="Identifier">result</span><span class="Punctuation">)</span> <span class="Operator">-</span> <span class="Identifier">n</span><span class="Punctuation">)</span> <span class="Operator">/</span> <span class="Identifier">pow</span><span class="Punctuation">(</span><span class="Identifier">E</span><span class="Punctuation">,</span> <span class="Identifier">result</span><span class="Punctuation">)</span><span class="Punctuation">)</span>
<span class="Identifier">echo</span> <span class="Identifier">ln</span><span class="Punctuation">(</span><span class="DecNumber">5</span><span class="Punctuation">)</span>
<span class="Keyword">proc</span> <span class="Identifier">log</span><span class="Punctuation">(</span><span class="Identifier">n</span><span class="Punctuation">,</span> <span class="Identifier">base</span><span class="Punctuation">:</span> <span class="Identifier">float64</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">float64</span> <span class="Operator">=</span>
<span class="Keyword">var</span> <span class="Identifier">next</span><span class="Punctuation">:</span> <span class="Identifier">float64</span> <span class="Operator">=</span> <span class="FloatNumber">1.0</span>
<span class="Keyword">while</span> <span class="Keyword">not</span> <span class="Identifier">almostEqual</span><span class="Punctuation">(</span><span class="Identifier">result</span><span class="Punctuation">,</span> <span class="Identifier">next</span><span class="Punctuation">,</span> <span class="DecNumber">1</span><span class="Punctuation">)</span><span class="Punctuation">:</span>
<span class="Identifier">result</span> <span class="Operator">=</span> <span class="Identifier">next</span>
<span class="Keyword">let</span> <span class="Identifier">top</span> <span class="Operator">=</span> <span class="Identifier">pow</span><span class="Punctuation">(</span><span class="Identifier">base</span><span class="Punctuation">,</span> <span class="Identifier">result</span><span class="Punctuation">)</span> <span class="Operator">-</span> <span class="Identifier">n</span>
<span class="Keyword">let</span> <span class="Identifier">bottom</span> <span class="Operator">=</span> <span class="Identifier">pow</span><span class="Punctuation">(</span><span class="Identifier">base</span><span class="Punctuation">,</span> <span class="Identifier">result</span><span class="Punctuation">)</span> <span class="Operator">*</span> <span class="Identifier">ln</span><span class="Punctuation">(</span><span class="Identifier">base</span><span class="Punctuation">)</span>
<span class="Identifier">next</span> <span class="Operator">=</span> <span class="Identifier">result</span> <span class="Operator">-</span> <span class="Punctuation">(</span><span class="Identifier">top</span> <span class="Operator">/</span> <span class="Identifier">bottom</span><span class="Punctuation">)</span>
<span class="Identifier">echo</span> <span class="Identifier">log</span><span class="Punctuation">(</span><span class="DecNumber">5</span><span class="Punctuation">,</span> <span class="DecNumber">10</span><span class="Punctuation">)</span>
</code><div class="code-buttons"><button class="btn btn-primary btn-sm">Run</button></div></pre></p><span>
</span><p><span>I was creating this while trying to create logarithm functions using other kinds of decimals/fractions other than floats, and realized that </span><tt class="docutils literal"><span class="pre">std/math</span></tt><span> </span><span>just uses c bindings.</span></p><span>
</span><p><span>I hope this helps someone in some way :)</span></p></div>Cross compilation to Windows, linker error (unrecognized option '-z'urn:entry:738342024-03-27T16:38:49Z2024-03-27T16:38:49ZthindilOn 2024-03-27 16:38:49, thindil said:
<p>
<div><p><span>Out of curiosity, what happens when you add two more flags: </span><tt class="docutils literal"><span class="pre">--cpu:amd64</span></tt><span> </span><span>and </span><tt class="docutils literal"><span class="pre">--os:windows</span></tt><span>?</span></p><span>
</span><p><span>From my experience, cross-compilation from Linux to Windows works with Nim. Just I set it some time ago, and with a different version of mingw.</span></p></div>Strange behavior of global variable in 2.0urn:entry:738332024-03-27T16:31:25Z2024-03-27T16:31:25ZchaemonOn 2024-03-27 16:31:25, chaemon said:
<p>
<span>I also noticed that gc:refc works well but gc:orc is not working.</span>