samedi 4 février 2023

Why does this example use `2.` instead of `2.0` (decimal point with no decimals)?

I came across this tutorial, and I've never encountered this syntax: gp_Pnt aPnt1(-myWidth / 2., 0, 0);. I'm likely looking in the wrong places, but why does G++ accept all 3 of these variable initializations?

double a = 2;
double b = 2.;
double c = 2.0;

I don't remember coming across 2. - is this shorthand for 2.0, or are they different?

Aucun commentaire:

Enregistrer un commentaire