Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ Developers corner » Value with type float
Re: Value with type float [message #58228 is a reply to message #58227] Thu, 31 March 2022 13:49 Go to previous messageGo to previous message
Tom1
Messages: 1302
Registered: March 2007
Ultimate Contributor
Hi,

I could see some benefit for supporting float in Value too. (I do signal processing with floats, so they frequently end up in various locations in my code.)
Having Value supporting float and EditFloat/EditFloatSpin added would allow cleaner code with dialogs.

Currently I have to round the float value to a clean double with roundr() to avoid excessive decimal places in EditDouble/EditDoubleSpin display. Also, when reading the value out from EditDouble/EditDoubleSpin, I will need to cast first to (double) and only thereafter to (float).

As an example, I have filtering frequencies controlled with:
void SetHPF(float fc);
float GetHPF();

Filling the EditDoubleSpin:
hpf<<=roundr(GetHPF(),3);

Reading the EditDoubleSpin:
hpf.WhenAction=[&](){ SetHPF((float)(double)~hpf); };


With float Value and EditFloatSpin support I would expect to work with:
hpf<<=GetHPF();

And:
hpf.WhenAction=[&](){ SetHPF((float)~hpf); };

Anyway, changes in Core/CtrlCore/CtrlLib are something for Mirek to decide.

Best regards,

Tom
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Build U++ with CMake and Clang Example
Next Topic: A temporary solution to garbled code in U++applications built through MSVC
Goto Forum:
  


Current Time: Thu May 01 01:31:28 CEST 2025

Total time taken to generate the page: 0.03448 seconds