fork download
  1. #include <stdio.h>
  2. #include <stdint.h>
  3. #include <stdbool.h>
  4.  
  5. typedef union
  6. {
  7. double value;
  8. uint64_t bits;
  9. } double_bits;
  10.  
  11. int main(void)
  12. {
  13. printf("BOLSCHOE (NIIBAZZO) CHISLO:\n");
  14. uint64_t sign = 1;
  15. uint64_t exponent = ((1U << 11) - 1) - 1; // The last exponent is for NaN and INF.
  16. uint64_t mantissa = (1ULL << 52) - 1;
  17. double_bits large = { .bits = sign << 63 | exponent << 52 | mantissa };
  18. printf("%.1f\n", large.value);
  19.  
  20. printf("\nOCHE (NIIBAZZO) MALENKOE CHISLO:\n");
  21. exponent = 0; // Lowest possible negative exponent (denormalized number).
  22. mantissa = 1; // Lowest posssible mantissa (no implicit 53th bit).
  23. double_bits small = { .bits = sign << 63 | exponent << 52 | mantissa };
  24. printf("%.1100f\n", small.value);
  25. }
  26.  
Success #stdin #stdout 0s 4292KB
stdin
Standard input is empty
stdout
BOLSCHOE (NIIBAZZO) CHISLO:
-179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0

OCHE (NIIBAZZO) MALENKOE CHISLO:
-0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000494065645841246544176568792868221372365059802614324764425585682500675507270208751865299836361635992379796564695445717730926656710355939796398774796010781878126300713190311404527845817167848982103688718636056998730723050006387409153564984387312473397273169615140031715385398074126238565591171026658556686768187039560310624931945271591492455329305456544401127480129709999541931989409080416563324524757147869014726780159355238611550134803526493472019379026810710749170333222684475333572083243193609238289345836806010601150616980975307834227731832924790498252473077637592724787465608477820373446969953364701797267771758512566055119913150489110145103786273816725095583738973359899366480994116420570263709027924276754456522908753868250641971826553344726562500000000000000000000000000