TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

NetBSD 10.x Kernel Math_emulation

57 点作者 jaypatelani4 天前

4 条评论

jmclnx4 天前
I saw this a few days ago, nice, especially since Linux is dropping support for older hardware. Even OpenBSD is slowly limiting i386 (32bit) support:<p><a href="https:&#x2F;&#x2F;www.openbsd.org&#x2F;i386.html" rel="nofollow">https:&#x2F;&#x2F;www.openbsd.org&#x2F;i386.html</a><p>NetBSD so far has no plans to drop 32bit x86 support, and it is always nice to be able to run a modern UN*X on older hardware. IIRC, porting NetBSD to a new platform is quite easy when compared to other systems. This is due to how their HAL (hardware abstraction layer) is designed.<p>Today I saw in the OpenBSD @misc mailing list one of the issues they are having with i386 is rust is too large for them to compile on a i386 system. That means software packages that need rust are being removed from their packages.<p>This does not affect NetBSD because they allow cross-compiling of everything on their systems.
评论 #43955963 未加载
评论 #43955574 未加载
评论 #43964350 未加载
SudoSuccubus3 天前
This is the most worthless thing in the world. Why would anybody give a rat&#x27;s fucking ass about a third? Not even a third rate like a 10th rate. Fucking operating system having math support. Oh wow! Congratulations! Now you can go ahead and support computers from 1985 now
评论 #43959631 未加载
评论 #43962072 未加载
__s4 天前
This sort of platform support is cool, but it&#x27;s a sign when existing hardware is failing &amp; the platform support is shown with emulation<p>If uou run ancient hardware, use ancient software. Preservation efforts in keeping an image of that ancient software available makes sense (which becomes harder as modern build systems pull from network to build)
评论 #43953224 未加载
anthk3 天前
On math FP emulation, by looking up the code it seems pretty close to the code from Robert F. Illyes for Forth 83.<p>Forth implementation in Eforth it&#x27;s like this:<p><pre><code> ( FORTH-83 FLOATING POINT. ---------------------------------- COPYRIGHT 1985 BY ROBERT F. ILLYES PO BOX 2516, STA. A CHAMPAIGN, IL 61820 PHONE: 217&#x2F;826-2734 ) HEX : ZERO OVER 0= IF DROP 0 THEN ; : FNEGATE 8000 XOR ZERO ; : FABS 7FFF AND ; : NORM &gt;R 2DUP OR IF BEGIN DUP 0&lt; NOT WHILE D2* R&gt; 1- &gt;R REPEAT SWAP 0&lt; - ?DUP IF R&gt; ELSE 8000 R&gt; 1+ THEN ELSE R&gt; DROP THEN ; : F2* 1+ ZERO ; : F* ROT + 4000 - &gt;R UM* R&gt; NORM ; : FSQ 2DUP F* ; : F2&#x2F; 1- ZERO ; : UM&#x2F; DUP &gt;R UM&#x2F;MOD SWAP R&gt; OVER 2* 1+ U&lt; SWAP 0&lt; OR - ; : F&#x2F; ROT SWAP - 4000 + &gt;R 0 ROT ROT 2DUP U&lt; IF UM&#x2F; R&gt; ZERO ELSE &gt;R D2&#x2F; FABS R&gt; UM&#x2F; R&gt; 1+ THEN ; : ALIGN 20 MIN 0 DO D2&#x2F; LOOP ; : RALIGN 1- ?DUP IF ALIGN THEN 1 0 D+ D2&#x2F; ; : FSIGN FABS OVER 0&lt; IF &gt;R DNEGATE R&gt; 8000 OR THEN ; : F+ ROT 2DUP &gt;R &gt;R FABS SWAP FABS - DUP IF DUP 0&lt; IF ROT SWAP NEGATE R&gt; R&gt; SWAP &gt;R &gt;R THEN 0 SWAP RALIGN THEN SWAP 0 R&gt; R@ XOR 0&lt; IF R@ 0&lt; IF 2SWAP THEN D- R&gt; FSIGN ROT SWAP NORM ELSE D+ IF 1+ 2&#x2F; 8000 OR R&gt; 1+ ELSE R&gt; THEN THEN ; : F- FNEGATE F+ ; : F&lt; F- 0&lt; SWAP DROP ; ( FLOATING POINT INPUT&#x2F;OUTPUT ) DECIMAL CREATE PL 3 , HERE ,001 , , ,010 , , ,100 , , 1,000 , , 10,000 , , 100,000 , , 1,000,000 , , 10,000,000 , , 100,000,000 , , 1,000,000,000 , , : TENS 2* 2* LITERAL + 2@ ; HEX : PLACES PL ! ; : SHIFTS FABS 4010 - DUP 0&lt; NOT ABORT&quot; TOO BIG&quot; NEGATE ; : F# &gt;R PL @ TENS DROP UM* R&gt; SHIFTS RALIGN PL @ ?DUP IF 0 DO # LOOP &quot;. HOLD THEN #S ROT SIGN ; : TUCK SWAP OVER ; : F. TUCK &lt;# F# #&gt; TYPE SPACE ; : DFLOAT 4020 FSIGN NORM ; : F DFLOAT POINT TENS DFLOAT F&#x2F; ; : FCONSTANT F 2CONSTANT ; : FLOAT DUP 0&lt; DFLOAT ; : -+ DROP SWAP 0&lt; IF NEGATE THEN ; : FIX TUCK 0 SWAP SHIFTS RALIGN -+ ; : INT TUCK 0 SWAP SHIFTS ALIGN -+ ; 1. FCONSTANT ONE DECIMAL 34.6680 FCONSTANT X1 -57828. FCONSTANT X2 2001.18 FCONSTANT X3 1.4427 FCONSTANT X4 : EXP 2DUP INT DUP &gt;R FLOAT F- F2* X2 2OVER FSQ X3 F+ F&#x2F; 2OVER F2&#x2F; F- X1 F+ F&#x2F; ONE F+ FSQ R&gt; + ; : FEXP X4 F* EXP ; : GET BL WORD DUP 1+ C@ &quot;- = TUCK - 0 0 ROT CONVERT DROP -+ ; : E F GET &gt;R R@ ABS 13301 4004 *&#x2F;MOD &gt;R FLOAT 4004 FLOAT F&#x2F; EXP R&gt; + R&gt; 0&lt; IF F&#x2F; ELSE F* THEN ; : E. TUCK FABS 16384 TUCK - 4004 13301 *&#x2F;MOD &gt;R FLOAT 4004 FLOAT F&#x2F; EXP F* 2DUP ONE F&lt; IF 10 FLOAT F* R&gt; 1- &gt;R THEN &lt;# R@ ABS 0 #S R&gt; SIGN 2DROP &quot;E HOLD F# #&gt; TYPE SPACE ; </code></pre> the float abs function it&#x27;s literally the same, operating over the same bits.<p>On the lack of floating point on some arch, Forth itself (even ANS Forth) encourages you to follow a fixed point philosophy unless it&#x27;s absolutely neccesary, because you can always scale up the magnitudes on big 32 bit machines.<p>And Pi can be prise enough by using scaling with &#x27;double&#x27; (for 16 bit machines) numbers:<p>100.000 355 113 m*&#x2F; d. 314159 ok