frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

Moving integer division to floating-point is trivial

http://marc-b-reynolds.github.io/math/2026/08/10/IntDivByFP.html
13•matt_d•3d ago

Comments

RossBencina•28m ago
x and y are integers represented as floating point

  > d = trunc(x/y);     // floor works for unsigned
  >
  > // NOTE: if only want 'd' and it's being converted to an
  > // integer then the truncate or floor operation is
  > // free in the float to integer conversion.
Please show me how to portably truncate or floor a floating point value to an int in C for "free".
mtklein•14m ago
They're typically like a 3-cycle op, right? Obviously that's not zero, but as far as floating point ops get it's a cheap as it gets, like an add, mul, fma, that sorta thing.
ranger_danger•9m ago
Perhaps they meant implicit instead of free, since the comment also explains that `d` is an integer and the intent is to truncate, so the trunc() call is not even necessary when the assigning type is an int.
juancn•8m ago
I would love to have some benchmarks for this on some reasonably practical scenario.

In many common cases shift and masking can replace integer division (i.e. hash tables) and you avoid division altogether, and that probably has about the cost of converting an int to a float.

taeric•4m ago
I'm curious that the latency of these is actually worse than the latency of floating operations. Yes, they are worse than many integer instructions, but they seem to be on basically the same order as the equivalent float operations?

Qwen 3.8 27B

https://huggingface.co/Qwen/Qwen3.8-27B-FP8
491•erdaltoprak•4h ago•340 comments

Count Binface receives over a quarter of votes in Clacton by-election

https://www.bbc.com/news/articles/ce97mm3vvemo
260•tcp_handshaker•2h ago•167 comments

Seven books I keep close because I love them

https://blog.plover.com/2026/08/02/
191•surprisetalk•4h ago•83 comments

RustDesk now supports true unattended remote access on Wayland

https://rustdesk.com/blog/unattended-remote-access-wayland/
106•rustdesk•3h ago•46 comments

Why does Opus 5 feel worse to work with?

https://mun-logadan.github.io/why-does-opus-5-feel-worse/
537•numeri•9h ago•493 comments

GLM-5.3: Frontier coding with emergent cyber capabilities

https://z.ai/blog/glm-5.3
953•pella•13h ago•477 comments

Google is making private AI practical with homomorphic encryption

https://blog.google/security/how-google-is-making-private-ai-practical-with-homomorphic-encryption/
107•u1hcw9nx•3h ago•69 comments

Introducing Toast 1

https://www.mixedbread.com/blog/toast-1
126•mplappert•4h ago•37 comments

AI by Hand

https://www.byhand.ai/
77•sans_souse•3h ago•9 comments

Show HN: Embed a real Linux terminal on your website

https://sandbox.bio/training/embed
7•raboukhalil•22m ago•1 comments

Maximizing the value of your Claude Code sessions

https://claude.com/blog/maximizing-the-value-of-your-claude-code-sessions
66•twapi•2h ago•34 comments

Ultraviolet Bird Photography

https://uvbirds.com/
55•EndXA•1w ago•8 comments

I turned my RSS feeds into an e-ink newspaper to stop reading on my phone

https://heyjonny.dev/posts/rss-to-eink-newspaper/
79•speckx•4h ago•32 comments

Forbidden City Cabbage

https://www.cnn.com/2025/11/10/style/jadeite-cabbage-taiwan-forbidden-city-curio-hnk-intl
30•dude250711•2d ago•4 comments

Every Fucking Website (2020)

https://lxe.github.io/everywebsite/
600•doubletwoyou•4h ago•350 comments

A Contract-Grade Verifier for LLM-Generated GPU Kernels

https://arxiv.org/abs/2608.12700
12•Jimmc414•2h ago•0 comments

Show HN: LuaCAD – Parametric CAD Scripted in Lua

https://luacad.ad-si.com
36•adius•2h ago•6 comments

Don't classify, hallucinate

https://softwaredoug.com/blog/2026/08/10/hypothetical-classifications
181•softwaredoug•3d ago•74 comments

France's top court blocks social media ban for under-15s

https://www.reuters.com/world/frances-top-court-rules-social-media-ban-curtails-freedom-expressio...
138•BlueBerry2001•3h ago•79 comments

DeepSeek peak/off-peak pricing update

https://api-docs.deepseek.com/news/news260813/
217•fagnerbrack•9h ago•117 comments

RayforceDB – a pure C analytics database with a Lisp-like syntax

https://rayforcedb.com/
25•sourdecor•3h ago•14 comments

Show HN: Mole – Deep research agent for your terminal

https://github.com/lajosdeme/mole
3•lajosdeme•20m ago•0 comments

Moving integer division to floating-point is trivial

http://marc-b-reynolds.github.io/math/2026/08/10/IntDivByFP.html
13•matt_d•3d ago•5 comments

In Australia, a home battery boom has helped cut wholesale power prices

https://e360.yale.edu/digest/australia-home-batteries
253•speckx•5h ago•192 comments

AI Model Atlas – visualizing populations of ML models as interconnected 3D graph

https://run.cosmograph.app/public/ca9fd1ad-fe83-4238-8b69-b707c633aef0
35•bj-rn•4h ago•5 comments

Gödel, Escher, Elisp: The Beauty of Macros

https://www.chiply.dev/post-elisp-macros-are-beautiful
61•JNRowe•1w ago•18 comments

Self-hosted web push Cloudflare Worker, works on iOS

https://kukuroo.cc/
41•saiday•4h ago•15 comments

The TEMU-Fication of Software, Digital Goods and Services

https://xn--gckvb8fzb.com/the-temu-fication-of-software-digital-goods-services/
95•surprisetalk•7h ago•73 comments

Earth.nullschool.net

https://earth.nullschool.net/
36•TremendousJudge•4h ago•13 comments

HashAgent – Share an AI agent as a URL, runs locally via WebGPU

https://hashagent.pages.dev/
38•masonhsu•6h ago•4 comments