Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
6
Erster Beitrag:
vor 4 Jahren, 6 Monaten
Letzter Beitrag:
vor 4 Jahren, 5 Monaten
Beteiligte Autoren:
JP, Peter Holemans, Fabrice Harari, Arie, Steven Sitas

Quantity - what data type to use?

Startbeitrag von Steven Sitas am 22.06.2013 10:13

I was wondering what datatype would be best to use for PRODUCT QUANTITIES in a Windev analysis - for HF?
It must have decimals so an integer is NO OPTION.
That leaves REAL and DECIMAL (Wlanguage Numeric) and (maybe?) CURRENCY.

I am playing with the IDEA to make all my numerics (that need decimals) to a currency type.
Anybody see any problem with this approach?

Steven Sitas

Antworten:

Steven,
I use CURRENCY for this and never had any problem.
This page shows some info about the difference between real/currency
http://doc.pcsoft.fr/en-US/?1514048

von Arie - am 22.06.2013 14:29
Hi

personnaly I'm using Numeric everywhere I need decimals, integers where I don't , currency only where it is a currency and I need the special currecny processes (currency sign and so on) and NEVER real

Best regards

von Fabrice Harari - am 22.06.2013 14:58
Quote
Fabrice Harari
Hi

personnaly I'm using Numeric everywhere I need decimals, integers where I don't , currency only where it is a currency and I need the special currecny processes (currency sign and so on) and NEVER real

Best regards


Hi Fabrice, can I ask why you never use real type? What is the reason?

von JP - am 20.08.2013 13:49
Hi JP,

The reason is stated in the help and this problem is not W-language specific but goes for most typed languages and since W-Language is build on top of C++ it inherits the issue for reals.

Therefore W-Language types Numeric and Currency overcome this.

See http://doc.pcsoft.fr/en-US/?1514048:
Quote
PCSoft Help
Problems of precision with the reals

The operations performed on the "real" types are not precise because of the computing representation of the reals.
Two reals that are equal mathematically speaking are not necessarily equal computer-wise and the ">", "" operators (or "=" and "


von Peter Holemans - am 20.08.2013 14:52
Hi Peter, thanks for the information. Very useful.

von JP - am 20.08.2013 15:24
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.