|
|
Log in / Subscribe / Register

size_of and align_of

size_of and align_of

Posted Jul 26, 2024 6:48 UTC (Fri) by tialaramex (subscriber, #21167)
In reply to: size_of and align_of by josh
Parent article: Rust 1.80.0 released

Ooh. I haven't been keeping up with the news. I have been gradually working on an implementation of "Towards an API for the Real Numbers" but in Rust. For those who haven't any reason to have investigated, this is Hans Boehm's work which (in Java) for a while powered the Android calculator UI where 1/3 + 1/3 + 1/3 = 1 because duh, that's true, floats aren't how arithmetic actually works. It's "Towards" because of course the Reals are not at all well behaved in general, Almost All of them are entirely unsuitable for computers, including humans - however a lot of the ones we care about could be pretty well behaved if our API was better.

This week I got to the point where Hans' "Computable Reals" stuff is starting to work, so it not only knows that a sum adds up to, say, 4 pi, but it can produce a decimal approximation, stretching for perhaps a few pages I think if requested though the default is only 20 digits.

I think the Lazy features would help me write optimal code where I often need small "big" Integers, such as 4 (used to compute Pi on demand) and I'd love to be able to have a 4 "ready to go" but unlike ordinary integers the big integers I use have heap allocations so they can't just be ordinary constants. I had thought I should investigate the libraries once it was more complete and now I won't have to perhaps.


The LWN site is currently under high scraper load, so comment display has been suppressed for anonymous users. If you are a human, you may read the comments by clicking the button below:

Note: you can avoid this step in the future by logging into your LWN account.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds