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 » U++ Library support » U++ Core » Value: why not float support?
Re: Value: why not float support? [message #30336 is a reply to message #30318] Sat, 25 December 2010 10:48 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14105
Registered: November 2005
Ultimate Member
kohait00 wrote on Fri, 24 December 2010 07:55


i have to admit, char, unsigned types and all that aren't there as well, but they are at least, binary compatible types, means
a char could be banary transported as int, and be interpreted as is later. this holds true for unsigned types as well. but float and double, when transported / serialized over net etc. are *not* binary compatible. though they might be treated equal in cpu, on the net and serialsation, they arent. float is 4 byte, double is 8. this is another pro for float.



AFAIK, there is little difference in promoting char to int and casting back and doing the same with float and double.

Quote:


i figured out, that all major database concepts (mysql, postgre sql, oracle, mssql) support float (or single precision).

the only exception is sqlite3, which only supports double, but one could fix this very fast i think, mapping float to double there.



Sure, and every single SQL engine accepts double there (then perhaps casting it to float internally).

Anyway, that is not a problem. The issue is that existing code, which includes SQL/U++ connectors (there is about 5 of them), does not expect to get something like V_FLOAT as Value.

Currently, any float gets promoted to 'double', so it is send as double and everything works. Make Value to remember that such a type is 'V_FLOAT' and you are sudenly missing appropriate case in switch....

Which is quite easy to fix in connectors and in 'uppsrc', actually, but IMO it is little demanding to expect every U++ users to scan through his code for similar cases.

To do that, I would need some solid reason...

And you still have not provided any clue how do you plan to use this Smile (A bit of end-user code would really be helpful). If you need to support 'char' in your interface, I do not see a single reason why you could not support 'float' the very same way.

Mirek
 
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: Core/Path.cpp: the limitation of GetCurrentDirectory for POSIX
Next Topic: InitCaps() proposal
Goto Forum:
  


Current Time: Fri Nov 01 01:38:02 CET 2024

Total time taken to generate the page: 0.02181 seconds