Timeline for Addition of two IEEE754-32bit single precision floating point numbers in C++
Current License: CC BY-SA 3.0
18 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jun 30, 2017 at 9:54 | answer | added | sathyarokz | timeline score: 0 | |
| S Aug 28, 2016 at 12:28 | history | bounty ended | RE60K | ||
| S Aug 28, 2016 at 12:28 | history | notice removed | RE60K | ||
| Aug 28, 2016 at 12:28 | vote | accept | RE60K | ||
| Aug 28, 2016 at 6:34 | answer | added | FirefoxMetzger | timeline score: 4 | |
| Aug 22, 2016 at 20:10 | history | tweeted | twitter.com/StackCodeReview/status/767816236034064385 | ||
| Aug 22, 2016 at 15:53 | answer | added | DJHenjin | timeline score: 2 | |
| S Aug 21, 2016 at 7:32 | history | bounty started | RE60K | ||
| S Aug 21, 2016 at 7:32 | history | notice added | RE60K | Draw attention | |
| Aug 19, 2016 at 6:02 | comment | added | RE60K | @Quuxplusone oh sorry. | |
| Aug 18, 2016 at 19:32 | comment | added | Random832 |
@ADG Most C/C++ implementations use IEEE754 32-bit single precision for float and IEEE754 64-bit double precision for double - implementations that do not use these representations are very rare, even among implementations that do not fully conform to the standard for operations. And *(float*)&x isn't a cast to a float, it is a "type-pun" via a pointer cast (generally in C++ you would use reinterpret_cast). You could also convert it to float or double in a portable way with ldexp[f].
|
|
| Aug 18, 2016 at 17:19 | comment | added | Random832 | @ADG float, then. | |
| Aug 18, 2016 at 14:26 | history | edited | 200_success |
edited tags
|
|
| Aug 18, 2016 at 11:48 | history | edited | ratchet freak | CC BY-SA 3.0 |
fixed code markup
|
| Aug 18, 2016 at 10:41 | history | edited | RE60K | CC BY-SA 3.0 |
added 2268 characters in body; edited title
|
| Aug 18, 2016 at 6:46 | comment | added | Quuxplusone |
You also leak memory like the dickens, and your use of macros is quite unusual for C++. Consider rewriting your macros as static inline functions instead.
|
|
| Aug 18, 2016 at 6:46 | comment | added | Quuxplusone |
You should provide more information about your constraints, because otherwise the clearest code would obviously be *(double*)&c = *(double*)&a + *(double*)&b; instead of all this stuff. Your test harness would also be more compelling if it compared the output of your bit-twiddling code to the naive floating-point implementation, instead of requiring the input file to contain the answer in hex.
|
|
| Aug 18, 2016 at 6:23 | history | asked | RE60K | CC BY-SA 3.0 |