[Solved] Combine two integers (one containing the integer part, the other the decimal part) into a floating point number

Cheating solution goes like this: string number = wholeNumber + “.” + decimal double doubleNumber = Double.Parse(number); Clean solution would involve checking how many values you have in the ‘decimal’, dividing by 10^amount and adding them As was pointed out – decimal seperator is cultural-specific – so the completly correct version is string number = … Read more

[Solved] wildly different behaviour between O2 and O3 optimized FP code [closed]

From GCC manual: -O3 Optimize yet more. -O3 turns on all optimizations specified by -O2 and also turns on the -finline-functions, -funswitch-loops, -fpredictive-commoning, -fgcse-after-reload, -ftree-vectorize, -fvect-cost-model, -ftree-partial-pre and -fipa-cp-clone options. No of these optimizations are particularly unsafe. The only optimization that I see can change the result is -ftree-vectorize. In some cases, using vector instructions … Read more

[Solved] Math-pow incorrect results

Your question is very unclear; in the future, you’ll probably get better results if you post a clear question with a code sample that actually compiles and demonstrates the problem you’re actually having. Don’t make people guess what the problem is. If what you want to do is display a double-precision floating point number without … Read more

[Solved] What’s different between a single precision and double precision floating values? [duplicate]

In C, double has at least as much precision as, and usually more than, float, and has at least the exponent range of, and usually more than, float. The C standard only requires that double be able to represent all the values of float: “The set of values of the type float is a subset … Read more