PDA

Ver la Versión Completa : Decimales


alexisns
22-06-2003, 20:55:14
Hola foreros, necesito ayuda:

He creado una tabla Paradox donde existe un campo tipo decimal (#), le he dado la longitud 15.

En este campo almaceno un número con 8 decimales, desde el Database Desktop introduzco el dato sin ningún problema y aparece el número con 8 decimales.

Abro la tabla con Delphi, le asigno a la propiedad DisplayFormat del campo en cuestión '0.00000000', lo conecto con un TDBEdit y si por ejemplo el valor era 0,12345678, me aparece 0,12350000, o sea me redondea a cuatro decimales en vez de redondear a ocho decimales.

Espero alguien me pueda ayudar, muchas gracias.

Alexis.

marcoszorrilla
22-06-2003, 21:31:53
El asunto viene por aquí:

Specifies the number of digits of accuracy used to store the field value.

property Precision: Integer;

Description

Precision can be a value between 0 and 32. However, because TBCDField uses the Currency type to work with data from BCD fields, TBCDField limits the precision of the BCD values it can support to 4 decimal places and 20 significant digits. The underlying database table may include values that require greater precision, and setting precision to a value greater than 20 allows you to create a table with higher precision.


Yo cambiaría el campo a tipo numérico y me olvidaría del tema, puesto que como numérico te va a funcionar sin ningún problema.

Un Saludo.

alexisns
22-06-2003, 21:45:40
Muchas gracias Marcos, cambiando a numérico funciona perfectamente.

Alexis.