Skip to content

Conversation

@eyalroz
Copy link
Owner

@eyalroz eyalroz commented Feb 7, 2022

Fixes #84.

@jrahlf
Copy link

jrahlf commented Feb 7, 2022

I think it looks good so far.

  • previously platforms where double is 32-bit (GCC-AVR) were supported implicitly (without documentation), this update breaks this unless PRINTF_USE_DOUBLE_INTERNALLY is set to 0. Either the code or the documentation should be updated accordingly.
  • As shown in the other PR, to get the full benefit, one must (try to) also get rid of the int64_t<>float conversions, but this can also be attempted in another PR

I can try it out on microcontroller on the weekend.

@eyalroz
Copy link
Owner Author

eyalroz commented Feb 7, 2022

this update breaks this unless PRINTF_USE_DOUBLE_INTERNALLY is set to 0

It shouldn't! If that happens, I have a bug. I tried to support double = 32-bits even when PRINTF_USE_DOUBLE_INTERNALLY is 1.

but this can also be attempted in another PR

One step at a time :-) ... also, I've created v6.0.0 with my recent changes. Would appreciate feedback there as well.

@jrahlf
Copy link

jrahlf commented Feb 8, 2022

this update breaks this unless PRINTF_USE_DOUBLE_INTERNALLY is set to 0

It shouldn't! If that happens, I have a bug. I tried to support double = 32-bits even when PRINTF_USE_DOUBLE_INTERNALLY is 1.

I misread the code, I think you are right.

@eyalroz
Copy link
Owner Author

eyalroz commented Feb 8, 2022

Just so you know, though, I'm not hurrying to merge this before I get some feedback of the v6.0.0 pre-release; and properly release it. Then this can go on the development branch.

* Can now choose between using `double` and `float` internally, for floating-point work, using the `PRINTF_USE_DOUBLE_INTERNALLY` definition and corresponding CMake option.
* Adjusted test suite to support the different choice of floating-point type:
	* Tests relevant both to `float` and `double`, but with different precisions, are adjusted with an `#if #else #endif`
	* Tests and test cases relevant only for `double` precision are not compiled at all when `float` is used.
* Lots of new explicit conversions :-(
@eyalroz eyalroz merged commit 61921be into develop Jan 21, 2023
@crazybolillo
Copy link

Hello, I see this was merged into develop. I personally tried this new option on a Cortex M4 with FP unit and it reduced code size by around 800 bytes, so that is good. Also my program still works fine. Thanks for the work, just thought I would give a testimony to the fact this works hehe.

@eyalroz
Copy link
Owner Author

eyalroz commented Oct 10, 2023

Thank you, @crazybolillo , it's nice to get positive feedback :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants