HNHacker News
TopNewBestAskShowJobs

marko_oktabyr

20 karma · joined June 8, 2023

submissionscomments
marko_oktabyr··on Laid off for the first time in my career, and twice in one year
I may be a tad late, but typst does have a compiler you can use locally with your favorite local text editor.

https://github.com/typst/typst/releases

marko_oktabyr··on Surprised to see that the standard CO2 level on the space station is 4000 ppm
NASA’s Office of the Chief Heath and Medical Officer has published a number of technical briefs [0] that cover a variety of human spaceflight related risks and topics. In particular, they have one for carbon dioxide [1, PDF warning] with some references that may interest you.

[0]: https://www.nasa.gov/ochmo/health-operations-and-oversight/h... [1]: https://www.nasa.gov/wp-content/uploads/2023/12/ochmo-tb-004...

marko_oktabyr··on Why Python's integer division floors (2010)
At the risk of being snarky, I should certainly hope the output depends on the input.

On a more serious note, there are quite reasonable properties that are satisfied by keeping the sign of the first argument as the chosen representative. In particular, for any two nonzero integers a and b, we have that:

a = (a / b) * b + (a mod b)

Where division should be interpreted as integer division that rounds towards zero. If a=-1 and b=3, then (a/b) would be zero which would require (a mod b) to be -1 if we want the above to hold. Also note that other rounding choices (e.g., rounding towards negative infinity) could impose (a mod b) = 2.

So choosing a particular representative comes down to choosing what properties you want your function to have in relation to other arithmetic.

marko_oktabyr··on Why Python's integer division floors (2010)
> That's not how modulo arithmetic works.

We should be a bit careful with what one means by "modulo arithmetic" here. If we are talking about arithmetic in Z/nZ (read "integers modulo n"), then the objects being acted upon are no longer integers, but equivalence classes of integers. That is, the set of all integers that satisfy the equivalence relation "~" where "a ~ b" means a - b = k*n for some integer k. For example, one of the equivalence classes in Z/3Z would be the set {..., -4, -1, 2, 5, ...}.

Since every element of the set is equivalent under that relation, we typically will choose a representative of that equivalence class, e.g., [2] for the previous class. If we view the "mod" or "modulo" operator to be a mapping from the integers to a particular representative of its equivalence class, there's no reason that negative values should be excluded. [-1] refers to the same equivalence class as [2], [32], and [-7]. The details of how integers are mapped to a chosen representative seem to vary from language to language, but modular arithmetic works all the same between them.

marko_oktabyr··on Why Python's integer division floors (2010)
As sibling comments have mentioned, "operator" here is being used in the programming language sense of the word, not the mathematical sense. Using the name "mod" [as in mod(a,n)] or "modulo" for the mapping that takes integers to a particular representative of its equivalence class in Z/nZ ("integers modulo n") doesn't seem like an unreasonable choice to me.