4 ms·
Even if you do use arbitrary precision arithmetic and count nanoseconds, the heat death of the universe is more likely to occur before your number takes 1KiB of
by ainar-g 8y ago
Even if you do use arbitrary precision arithmetic and count nanoseconds, the heat death of the universe is more likely to occur before your number takes 1KiB of RAM.
- gvx 8y agoIf my calculations are correct, 520 bits should be enough to count in units of Planck time until the heath death of the universe.
- bunderbunder 8y agoProbably the deeper problem with using arbitrary precision arithmetic is that you end up with a variable-sized datatype, which I believe means at least a modicum of extra hassle & complexity for any language that the control software is likely to be written in. And less predictable timing, which might be a big no-no if this is something that needs to be used in timing-sensitive places. I'd much rather take the 64-bit int, myself.
- lucb1e 8y agoI was going to comment how you should probably still account for an overflow condition by warning at 70%, beeping at 80%, refusing to take off at 85%, etc., but it turns out that even with nanosecond precision timekeeping (1e-9), a signed 64 bit integer is enough for 292 years of not rebooting. (2^63)/1e9/3600/24/365 = ~292 Yeah, just go for that 64-bit int and call it a day.
- deleted 8y ago[deleted]
- AnimalMuppet 8y agoIf I recall correctly, at least some guidelines for avionics software (JSF, maybe?) forbid dynamic memory allocations, period.
- bunderbunder 8y agoJPL's does. See Rule 5, on page ten: https://lars-lab.jpl.nasa.gov/JPL_Coding_Standard_C.pdf https://lars-lab.jpl.nasa.gov/JPL_Coding_Standard_C.pdf
- monocasa 8y agoIn addition to JPL's, the JSF's does too, after initialization. That is you can malloc at startup, but not past that.
- berti 8y agoThat's a general thing for safety critical real-time systems, not just avionics.
- manicdee 8y agoAre you assuming an update to a number will use the same memory as the original number, and that the original memory will be released?