diff options
| author | hachem <im@hachem.wtf> | 2026-09-14 12:20:52 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2026-09-14 12:20:52 +0200 |
| commit | ee14ad272e68d9363202d7f668e0b20302827209 (patch) | |
| tree | 88dd1012ad7f9d6ac7abeb7562dac2194794b823 /src/maths/format.c | |
| parent | ae07aab1442a45bbddb79e066f15eaf252a4254a (diff) | |
feat: simd + testing + formatting
Diffstat (limited to 'src/maths/format.c')
| -rw-r--r-- | src/maths/format.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/maths/format.c b/src/maths/format.c index ad80ff0..f3db83d 100644 --- a/src/maths/format.c +++ b/src/maths/format.c @@ -15,10 +15,10 @@ static bool approx_eq(double a, double b) return fabs(a - b) < EPSILON; } -static bool real_symbolic(double v, char *out, size_t cap) +static bool real_symbolic(double v, char* out, size_t cap) { double abs_v = fabs(v); - const char *sign = v < 0.0 ? "-" : ""; + const char* sign = v < 0.0 ? "-" : ""; if (approx_eq(abs_v, 0.0)) { @@ -26,7 +26,7 @@ static bool real_symbolic(double v, char *out, size_t cap) return true; } - const char *sym = NULL; + const char* sym = NULL; if (approx_eq(abs_v, 1.0)) sym = "1"; else if (approx_eq(abs_v, 0.5)) @@ -58,7 +58,7 @@ static bool real_symbolic(double v, char *out, size_t cap) return true; } -char *psi_format_amplitude(struct PsiComplex c, char *out, size_t cap) +char* psi_format_amplitude(struct PsiComplex c, char* out, size_t cap) { double re = c.real; double im = c.imaginary; @@ -108,7 +108,7 @@ char *psi_format_amplitude(struct PsiComplex c, char *out, size_t cap) } else { - const char *sign = im > 0.0 ? "+" : "-"; + const char* sign = im > 0.0 ? "+" : "-"; char sym[32]; if (real_symbolic(fabs(im), sym, sizeof sym)) snprintf(im_str, sizeof im_str, "%s%si", sign, sym); @@ -120,7 +120,7 @@ char *psi_format_amplitude(struct PsiComplex c, char *out, size_t cap) return out; } -char *psi_format_probability(double p, char *out, size_t cap) +char* psi_format_probability(double p, char* out, size_t cap) { if (approx_eq(p, 0.0)) snprintf(out, cap, "%s", "0"); |
