As I understand, you want to generate some C code which represents an array of 3D coordinates, created with SpherePoints. You can do this with string processing and CForm.
Example:
coordsToC3D[coord_] := "float coord[][3] = {\n\t\t" <>
StringRiffle[
ToString /@ Map[CForm, coord, {2}],
",\n\t\t"
] <>
"\n};\n"
coordsToC3D[SpherePoints[10]]
"float coord[][3] = {
{-0.8944271909999157, 0., -0.44721359549995787},
{0.8944271909999157, 0., 0.44721359549995787},
{-0.7236067977499789, -0.5257311121191336, 0.44721359549995787},
{-0.7236067977499789, 0.5257311121191336, 0.44721359549995787},
{-0.276393202250021, -0.85065080835204, -0.44721359549995787},
{-0.276393202250021, 0.85065080835204, -0.44721359549995787},
{0.276393202250021, -0.85065080835204, 0.44721359549995787},
{0.276393202250021, 0.85065080835204, 0.44721359549995787},
{0.7236067977499789, -0.5257311121191336, -0.44721359549995787},
{0.7236067977499789, 0.5257311121191336, -0.44721359549995787}
};
"
This produces numbers with enough digits for double precision (double), which means that it's also sufficient for float.
You can export this to a file using Export, picking the "String" format.
CFormbut it will not give that specific format. Maybe these are related https://mathematica.stackexchange.com/q/209239/86543 or https://mathematica.stackexchange.com/q/175094/86543 – userrandrand Dec 28 '22 at 19:15CFormshould be sufficient though, as it preserves enough digits for a double precision number. However, what you show, with anfsuffix, is not double precision, but single precision. – Szabolcs Dec 28 '22 at 20:11CFormare double-precision and can be assigned to eitherfloatordoublebecause the compiler will figure out the correct conversion if needed. If you want to go further and make sure that every last bit of your number is transferred to C, you can use a binary floating-point literal that you'd need to construct somehow in Mathematica. – Roman Dec 28 '22 at 20:34fsuffix in C indicates thefloattype, i.e. single precision floating point. Please edit the question and update it to address the questions in the comments. It looks like the question is not actually asking what you said you wanted to do in the comments. If you want to produce a C header file, ask about that. Please take a look at https://xyproblem.info/ – Szabolcs Dec 28 '22 at 22:29SpherePoint, but its standard output is not formatted the way I need, which is single precision float written like0.0000000000000000e+00f. How can I obtain this? – Daniel Courville Dec 29 '22 at 13:54CFormand some string processing functions to construct a C header file. No need to worry about single-vs-double precision for the constant—it's sufficient to assign to afloat []variable. – Szabolcs Dec 29 '22 at 16:52