diff options
| author | Julian Weigt <juw@posteo.de> | 2025-12-25 09:01:20 +0000 |
|---|---|---|
| committer | Julian Weigt <juw@posteo.de> | 2026-02-04 15:55:46 +0100 |
| commit | 09e687c7b0cd8795da95af3d8ec35d992e5be218 (patch) | |
| tree | 7378ec5c823a0f89a9620d5213447f6cb8fc6838 | |
| parent | f3129294bf92daae6ca72e2f8c456bdff97b8b3e (diff) | |
Add string printing to double.
| -rw-r--r-- | double.c | 6 | ||||
| -rw-r--r-- | double.h | 2 |
2 files changed, 8 insertions, 0 deletions
@@ -1,5 +1,6 @@ #include <stdlib.h> #include <math.h> +#include <stdio.h> double convert_int(int i){ return (double) i; } @@ -18,3 +19,8 @@ double absolute(double d){ return fabs(d); } double power(double d, double p) { return pow(d,p); } double to_double(double d){ return d; } + +bool to_string(char* s, double d){ + sprintf(s,"%f",d); + return true; +} @@ -15,3 +15,5 @@ double absolute(double); double power(double,double); double to_double(double); + +double to_string(char*,double); |
