Answers for "c++ solve float single precision"

C++
1

how to print 5 precision float in c++

#include <iostream>
#include <cstdio>
using namespace std;

int main() 
{
    // This code helps you to print a number with desired decimal
    double Number=10.3454;
    printf("%.3lf",Number);

    return 0;
}
Posted by: Guest on June-07-2020
0

c++ double higher precision then float

For representing floating point numbers, we use float, double and long double.

What’s the difference ?

double has 2x more precision then float.

float is a 32 bit IEEE 754 single precision Floating Point Number1 bit for the sign, (8 bits for the exponent, and 23* for the value), i.e. float has 7 decimal digits of precision.

double is a 64 bit IEEE 754 double precision Floating Point Number (1 bit for the sign, 11 bits for the exponent, and 52* bits for the value), i.e. double has 15 decimal digits of precision.
Posted by: Guest on August-09-2021

Browse Popular Code Answers by Language