How to print the shortest representation of long double value in C

1 Answer

0 votes
#include <stdio.h>

int main() {
    long double ld = 854016.5891;

    printf("%g\n", (double)ld);

    return 0;
}

    
          
/*
run:
       
854017
  
*/

 



answered Jun 5, 2024 by avibootz

Related questions

1 answer 119 views
1 answer 137 views
1 answer 142 views
1 answer 136 views
1 answer 263 views
263 views asked Dec 28, 2020 by avibootz
1 answer 121 views
...