Ticket #1258 (assigned defect)

Opened 5 years ago

Last modified 4 years ago

midcom.helper.datamanager2: big floats are displayed incorrectly

Reported by: flack Assigned to: piotras (accepted)
Priority: major Milestone: 8.09.10 Ragnaroek
Component: MidCOM component Version: 8.09 Ragnaroek
Keywords: Cc:

Description

If I have a large float value like 2900000, it is displayed f.x. in DM2 edit forms as 2,9E+6. If I try to save the edit form, I get the error "This is no valid number.".

For easier handling, it would be better if midgard core could ensure that all floats are in normal decimal notation when passing them to the php object

Change History

10/20/09 12:59:36 changed by piotras

  • milestone changed from 8.09.6 Ragnaroek to 8.09.7 Ragnaroek.

11/26/09 16:43:40 changed by piotras

  • status changed from new to assigned.

Please, explain "normal decimal notation".

03/19/10 18:21:09 changed by indeyets

It is definitely not Midgard Core (which returns double-type, not formatted string). It's either midgard-php or or even midcom

03/19/10 19:44:01 changed by flack

To reproduce add the following to the schema.xml:

    <property name="floatfield" type="float" dbtype="double" />

Add this to the DM2 schema:

        'floatfield' => array (
            'title' => 'Float Field',
            'storage'    => 'floatfield',
            'type' => 'number',
            'type_config' => Array
            (
            	'precision' => 2,
            ),
            'widget' => 'text',
        ),

Create a new object onsite using datamanager. Enter "2900000" into the floatfield input field. Save.

Edit the newly created object onsite using datamanager. floatfield is prefilled with "2,9E+6". Click on save without making any changes. Datamanager will refuse to save and output "This is no valid number."

I'm sure "normal decimal notation" is not the correct term, but what I was trying to say is that the number shold be outputted in a format that DM2 (and users) can understand, so in this case 2900000 would be nice.

03/19/10 19:45:58 changed by flack

BTW: phpMyAdmin shows the value as 2,9E+6 as well, so this might be an optimization that MySQL does. Maybe this just needs fixing in the DM2 type and widget

03/25/10 08:41:01 changed by indeyets

  • component changed from Midgard Core to MidCOM component.
  • summary changed from big floats are displayed incorrectly to midcom.helper.datamanager2: big floats are displayed incorrectly.

It's not midgard-core's fault — It's php.

Here's little test (I use 64-bit system, so had to use larger number):

$fl = 2900000000000000000000;
var_dump($fl);

output:

float(2.9E+21)

so, moving to datamanager