frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

NetBSD 10.x Kernel Math_emulation

https://mezzantrop.wordpress.com/2025/02/04/netbsd-10-x-kernel-math_emulation/
57•jaypatelani•9mo ago

Comments

__s•9mo ago
This sort of platform support is cool, but it's a sign when existing hardware is failing & the platform support is shown with emulation

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)

boricj•9mo ago
Sometimes it's useful to be able to run modern software on ancient hardware.

I once made an image of a hard disk so old it wouldn't work on anything newer than a Pentium. I plugged in a USB PCI card+USB stick and booted a modern-ish at the time Debian Live CD.

It took over 5 minutes to decompress just the kernel and a hour to copy the HDD to the USB stick, but it did work. The time delta between the oldest and newest component on that system was well over 20 years, sometimes this is what you have to do with what you have on hand.

jmclnx•9mo ago
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:

https://www.openbsd.org/i386.html

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.

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.

This does not affect NetBSD because they allow cross-compiling of everything on their systems.

anthk•9mo ago
OpenBSD runs perfectly fine under i386, atom user there.

I don't care about Rust and it's killer app Firefox, there are tons of alternatives for i686. From Luakit to Vimb.

johnklos•9mo ago
Compiling rust on a 32 bit system is a several year old issue. Enough of us made a fuss about it that the rust build system was fixed enough that this became possible again.

If rust doesn't compile on an i386 system with 4 gigs of memory, then that's very odd. I don't know much about rust, but I was still able to get it to compile for earmv6hf on a Raspberry Pi 3 with 1 gig of RAM. Perhaps the OpenBSD people need to try some of the things we've already figured out.

https://mail-index.netbsd.org/tech-pkg/2025/05/09/msg031137....

makz•9mo ago
Cannot find the mail in @misc you are talking about
jmclnx•9mo ago
Here it is

https://marc.info/?l=openbsd-misc&m=174696055709421&w=2

anthk•9mo ago
On math FP emulation, by looking up the code it seems pretty close to the code from Robert F. Illyes for Forth 83.

Forth implementation in Eforth it's like this:

    ( FORTH-83 FLOATING POINT.
      ----------------------------------
      COPYRIGHT 1985 BY ROBERT F. ILLYES
            PO BOX 2516, STA. A
            CHAMPAIGN, IL 61820
            PHONE: 217/826-2734  )     HEX
    : ZERO  OVER 0= IF DROP 0 THEN ;
    : FNEGATE 8000 XOR ZERO ;
    : FABS  7FFF AND ;
    : NORM  >R 2DUP OR
            IF BEGIN DUP 0< NOT
               WHILE D2* R> 1- >R
               REPEAT SWAP 0< - ?DUP
               IF R> ELSE 8000 R> 1+ THEN
            ELSE R> DROP THEN ;
    : F2*   1+ ZERO ;
    : F*    ROT + 4000 - >R UM* R> NORM ;
    : FSQ   2DUP F* ;
    : F2/   1- ZERO ;
    : UM/   DUP >R UM/MOD SWAP R>
            OVER 2* 1+ U< SWAP 0< OR - ;
    : F/    ROT SWAP - 4000 + >R
            0 ROT ROT 2DUP U<
            IF   UM/ R> ZERO
            ELSE >R D2/ FABS R> UM/ R> 1+
            THEN ;
    : ALIGN 20 MIN 0 DO D2/ LOOP ;
    : RALIGN 1- ?DUP IF ALIGN THEN
            1 0 D+ D2/ ;
    : FSIGN FABS OVER 0< IF >R DNEGATE R>
            8000 OR THEN ;
    : F+    ROT 2DUP >R >R FABS SWAP FABS -
            DUP IF DUP 0<
                    IF   ROT SWAP  NEGATE
                         R> R> SWAP >R >R
                    THEN 0 SWAP RALIGN
            THEN SWAP 0 R> R@ XOR 0<
            IF   R@ 0< IF 2SWAP THEN D-
                 R> FSIGN ROT SWAP NORM
            ELSE D+ IF 1+ 2/ 8000 OR R> 1+
                    ELSE R> THEN THEN ;
    : F-    FNEGATE F+ ;
    : F<    F- 0< SWAP DROP ;
    ( FLOATING POINT INPUT/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< NOT
            ABORT" TOO BIG" NEGATE ;
    : F#    >R PL @ TENS DROP UM* R> SHIFTS
            RALIGN PL @ ?DUP IF 0 DO # LOOP
            ". HOLD THEN #S ROT SIGN ;
    : TUCK  SWAP OVER ;
    : F.    TUCK <# F# #> TYPE SPACE ;
    : DFLOAT 4020 FSIGN NORM ;
    : F     DFLOAT POINT TENS DFLOAT F/ ;
    : FCONSTANT F 2CONSTANT ;
    : FLOAT DUP 0< DFLOAT ;
    : -+    DROP SWAP 0< 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 >R FLOAT F-
            F2* X2 2OVER FSQ X3 F+ F/
            2OVER F2/ F-     X1 F+ F/
            ONE F+ FSQ R> + ;
    : FEXP  X4 F* EXP ;
    : GET   BL WORD DUP 1+ C@ "- = TUCK -
            0 0 ROT CONVERT DROP -+ ;
    : E     F GET >R R@ ABS 13301 4004 */MOD
            >R FLOAT 4004 FLOAT F/ EXP R> +
            R> 0< IF F/ ELSE F* THEN ;
    : E.    TUCK FABS 16384 TUCK -
            4004 13301 */MOD >R
            FLOAT 4004 FLOAT F/ EXP F*
            2DUP ONE F<
            IF 10 FLOAT F* R> 1- >R THEN
            <# R@ ABS 0 #S R> SIGN 2DROP
            "E HOLD F# #>     TYPE SPACE ;
the float abs function it's literally the same, operating over the same bits.

On the lack of floating point on some arch, Forth itself (even ANS Forth) encourages you to follow a fixed point philosophy unless it's absolutely neccesary, because you can always scale up the magnitudes on big 32 bit machines.

And Pi can be prise enough by using scaling with 'double' (for 16 bit machines) numbers:

100.000 355 113 m*/ d. 314159 ok

SudoSuccubus•9mo ago
This is the most worthless thing in the world. Why would anybody give a rat'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
2000UltraDeluxe•9mo ago
It's a hobbyist project. It doesn't need any "worth" apart from the joy the author got from it.

Kudos to the author for doing this _and_ sharing it with the world.

anthk•9mo ago
This is about software emulated FP. OFC NetBSD used the FP module in CPU's since long ago.

Also, FP is not math, it's just a kind of math. And even Forth users will use a fixed point before going into float. With 32 bits, they will just scale the point and call it a day.

And seasoned Forth users will just use quotient arithmetic and output fractional parts as two items in the stack.

Parse, Don't Validate (2019)

https://lexi-lambda.github.io/blog/2019/11/05/parse-don-t-validate/
120•shirian•2h ago•52 comments

"Hate brings views": Confessions of a London fake news TikToker

https://www.londoncentric.media/p/london-tiktok-fake-news-creator-hate-immigrants
15•pbshgthm•16m ago•0 comments

Mathematicians disagree on the essential structure of the complex numbers

https://www.infinitelymore.xyz/p/complex-numbers-essential-structure
23•FillMaths•40m ago•5 comments

Simplifying Vulkan One Subsystem at a Time

https://www.khronos.org/blog/simplifying-vulkan-one-subsystem-at-a-time
110•amazari•3h ago•14 comments

Clean-room implementation of Half-Life 2 on the Quake 1 engine

https://code.idtech.space/fn/hl2
198•klaussilveira•5h ago•39 comments

Oxide raises $200M Series C

https://oxide.computer/blog/our-200m-series-c
282•igrunert•2h ago•163 comments

I started programming when I was 7. I'm 50 now and the thing I loved has changed

https://www.jamesdrandall.com/posts/the_thing_i_loved_has_changed/
226•jamesrandall•2h ago•173 comments

Show HN: I built a macOS tool for network engineers – it's called NetViews

https://www.netviews.app
78•n1sni•11h ago•30 comments

Qwen-Image-2.0: Professional infographics, exquisite photorealism

https://qwen.ai/blog?id=qwen-image-2.0
232•meetpateltech•7h ago•127 comments

Frontier AI agents violate ethical constraints 30–50% of time, pressured by KPIs

https://arxiv.org/abs/2512.20798
465•tiny-automates•14h ago•303 comments

Europe's $24T Breakup with Visa and Mastercard Has Begun

https://europeanbusinessmagazine.com/business/europes-24-trillion-breakup-with-visa-and-mastercar...
209•NewCzech•5h ago•167 comments

Show HN: I made paperboat.website, a platform for friends and creativity

https://paperboat.website/home/
5•yethiel•19m ago•3 comments

Jury told that Meta, Google 'engineered addiction' at landmark US trial

https://techxplore.com/news/2026-02-jury-told-meta-google-addiction.html
283•geox•3h ago•222 comments

Redefining Go Functions

https://pboyd.io/posts/redefining-go-functions/
36•todsacerdoti•2h ago•11 comments

Show HN: Rowboat – AI coworker that turns your work into a knowledge graph (OSS)

https://github.com/rowboatlabs/rowboat
5•segmenta•29m ago•0 comments

The US is flirting with its first-ever population decline

https://www.bloomberg.com/news/articles/2026-01-30/trump-immigration-crackdown-could-shrink-us-po...
121•alephnerd•2h ago•382 comments

A method and calculator for building foamcore drawer organisers

https://capnfabs.net/posts/foamcore-would-be-a-sick-name-for-a-music-genre/
20•evakhoury•21h ago•5 comments

Rust implementation of Mistral's Voxtral Mini 4B Realtime runs in your browser

https://github.com/TrevorS/voxtral-mini-realtime-rs
354•Curiositry•15h ago•47 comments

Ex-GitHub CEO Launches a New Developer Platform for AI Agents

https://entire.io/blog/hello-entire-world/
76•meetpateltech•1h ago•55 comments

Show HN: Distr 2.0 – A year of learning how to ship to customer environments

https://github.com/distr-sh/distr
45•louis_w_gk•4h ago•13 comments

RLHF from Scratch

https://github.com/ashworks1706/rlhf-from-scratch
39•onurkanbkrc•5h ago•1 comments

Discord Alternatives, Ranked

https://taggart-tech.com/discord-alternatives/
545•pseudalopex•22h ago•340 comments

Vercel's CEO offers to cover expenses of 'Jmail'

https://www.threads.com/@qa_test_hq/post/DUkC_zjiGQh
138•vinnyglennon•2h ago•97 comments

Why is the sky blue?

https://explainers.blog/posts/why-is-the-sky-blue/
742•udit99•1d ago•247 comments

Pure C, CPU-only inference with Mistral Voxtral Realtime 4B speech to text model

https://github.com/antirez/voxtral.c
262•Curiositry•15h ago•25 comments

80386 Barrel Shifter

https://nand2mario.github.io/posts/2026/80386_barrel_shifter/
50•jamesbowman•2d ago•4 comments

Zulip.com Values

https://zulip.com/values/
219•nothrowaways•16h ago•52 comments

Converting a $3.88 analog clock from Walmart into a ESP8266-based Wi-Fi clock

https://github.com/jim11662418/ESP8266_WiFi_Analog_Clock
583•tokyobreakfast•1d ago•186 comments

MIT Technology Review has confirmed that posts on Moltbook were fake

https://www.technologyreview.com/2026/02/06/1132448/moltbook-was-peak-ai-theater/
231•helloplanets•2d ago•111 comments

Discord will require a face scan or ID for full access next month

https://www.theverge.com/tech/875309/discord-age-verification-global-roll-out
1935•x01•1d ago•1851 comments