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•10mo ago

Comments

__s•10mo 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•10mo 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•10mo 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•10mo 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•10mo 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•10mo ago
Cannot find the mail in @misc you are talking about
jmclnx•10mo ago
Here it is

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

anthk•10mo 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•10mo 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•10mo 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•10mo 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.

Founder of GitLab battles cancer by founding companies

https://sytse.com/cancer/
1063•bob_theslob646•16h ago•212 comments

The road to electric – in charts and data [UK]

https://www.rac.co.uk/drive/electric-cars/choosing/road-to-electric/
38•zeristor•3h ago•32 comments

Technology: The (nearly) perfect USB cable tester does exist

https://blog.literarily-starved.com/2026/02/technology-the-nearly-perfect-usb-cable-tester-does-e...
65•birdculture•3d ago•21 comments

AI overly affirms users asking for personal advice

https://news.stanford.edu/stories/2026/03/ai-advice-sycophantic-models-research
650•oldfrenchfries•20h ago•491 comments

CSS is DOOMed

https://nielsleenheer.com/articles/2026/css-is-doomed-rendering-doom-in-3d-with-css/
343•msephton•13h ago•78 comments

The Loneliness of a Room of One's Own

https://newrepublic.com/article/206731/loneliness-room-one-virginia-woolf-hold-up
19•prismatic•3d ago•2 comments

The Many Roots of Our Suffering: Reflections on Robert Trivers (1943–2026)

https://quillette.com/2026/03/25/the-many-roots-of-our-suffering-reflections-on-robert-trivers-19...
15•Petiver•2d ago•1 comments

Solar is winning the energy race

https://www.dw.com/en/solar-is-winning-the-energy-race/a-76517556
39•doener•1h ago•17 comments

Alzheimer's disease mortality among taxi and ambulance drivers (2024)

https://www.bmj.com/content/387/bmj-2024-082194
130•bookofjoe•9h ago•76 comments

I turned my Kindle into my own personal newspaper

https://manualdousuario.net/en/how-to-kindle-personal-newspaper/
30•rpgbr•1d ago•15 comments

Nonfiction Publishing, Under Threat, Is More Important

https://newrepublic.com/article/207659/non-fiction-publishing-threat-important-ever
13•Hooke•3d ago•1 comments

OpenBSD on Motorola 88000 Processors

http://miod.online.fr/software/openbsd/stories/m88k1.html
98•rbanffy•1d ago•11 comments

A Verilog to Factorio Compiler and Simulator (Working RISC-V CPU)

https://github.com/ben-j-c/verilog2factorio
74•signa11•2d ago•9 comments

Further human + AI + proof assistant work on Knuth's "Claude Cycles" problem

https://twitter.com/BoWang87/status/2037648937453232504
210•mean_mistreater•15h ago•136 comments

I decompiled the White House's new app

https://thereallo.dev/blog/decompiling-the-white-house-app
523•amarcheschi•18h ago•191 comments

Show HN: Public transit systems as data – lines, stations, railcars, and history

https://publictransit.systems
6•qwertykb•2h ago•3 comments

What if AI doesn't need more RAM but better math?

https://adlrocha.substack.com/p/adlrocha-what-if-ai-doesnt-need-more
32•adlrocha•2h ago•5 comments

The ANSI art "telecomics" of the 1992 election

https://breakintochat.com/blog/2026/03/25/don-lokke-and-mack-the-mouse/
41•Kirkman14•2d ago•1 comments

I Built an Open-World Engine for the N64 [video]

https://www.youtube.com/watch?v=lXxmIw9axWw
400•msephton•22h ago•66 comments

The Hackers Who Tracked My Sleep Cycle

https://glama.ai/blog/2026-03-26-the-hackers-who-tracked-my-sleep-cycle
9•statements•2d ago•2 comments

A laser-based process that enables adhesive-free paper packaging

https://www.fraunhofer.de/en/press/research-news/2026/march-2026/sealing-paper-packaging-without-...
78•gnabgib•11h ago•34 comments

The case for becoming a manager

https://newsletter.thelongcommit.com/p/the-case-for-becoming-a-manager
47•jcmartinezdev•4d ago•37 comments

Linux is an interpreter

https://astrid.tech/2026/03/28/0/linux-is-an-interpreter/
203•frizlab•17h ago•51 comments

Android’s new sideload settings will carry over to new devices

https://www.androidauthority.com/android-sideload-carry-over-3652845/
91•croemer•13h ago•132 comments

Cat Itecture: Better Cat Window Boxes (2023)

https://gwern.net/catitecture
56•gggscript•1d ago•10 comments

OpenCiv1 – open-source rewrite of Civ1

https://github.com/rajko-horvat/OpenCiv1
149•caminanteblanco•16h ago•42 comments

Spanish legislation as a Git repo

https://github.com/EnriqueLop/legalize-es
745•enriquelop•22h ago•220 comments

The first 40 months of the AI era

https://lzon.ca/posts/other/thoughts-ai-era/
184•jpmitchell•15h ago•100 comments

InpharmD (YC W21) Is Hiring – Senior Ruby on Rails Developer

https://inpharmd.com/jobs/senior-ruby-on-rails-engineer
1•tulasichintha•12h ago

The Last Contract: William T. Vollmann's Battle to Publish an Epic (2025)

https://www.metropolitanreview.org/p/the-last-contract
26•benbreen•3d ago•6 comments