online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <stdio.h> #include <math.h> int main () { for (unsigned int precision = 31; precision > 1; --precision) { int max_fails = 3; printf ("New precision(%u): 1/2 = 0x%x\n", precision, (1 << precision) / 2); /* All new PNM code should support 16bits, 48bit colors */ for (unsigned int maxv = 1; maxv < 0xffff; ++maxv) { int new_adjust = (255 << precision) / maxv; float adjust = 255.0f / maxv; for (unsigned int value = 0; value < maxv; ++value) { unsigned char new_out = (value * new_adjust + (1 << precision) / 2) >> precision; unsigned char out = lroundf (value * adjust); if (new_out != out) { if (!(--max_fails)) goto try_next; printf ("Fail: %u!=%u @%u %u<=%u\n", new_out, out, precision, value, maxv); } } } try_next: ; } return (0); }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue