I am losing precision on double values, when I save data to the database. Im on OrientDB 2.1.2 and the latest PhpOrient. I am also using Ubuntu 14 (x64) with PHP 5.5
Here's the test schema:
create class TestPrecision extends BaseV
create property TestPrecision.number double
Executing the following truncates the number
$client = new \PhpOrient\PhpOrient( 'localhost', 2424 );
$client->username = 'user';
$client->password = 'pass';
$client->connect();
$client->dbOpen( 'test', 'user', 'pass' );
//create record
$odata= [ "number" => 33533.1424 ];
$rec = ( new Record() )->setOData( $odata )->setRid( new ID( /* CLUSTER ID */ ) );
$rec = $client->recordCreate( $rec );
//re-load record
$record = $client->loadRecord( $rec->getRid() )[0];
//output
echo "Number is: " . $record["number"]; //the number printed out is 33533.14
PS - I've tried inserting data from the Studio and precision was fine. Therefore, I think there's something inside the library which is causing number to round up.
Hi @Ostico,
I am losing precision on double values, when I save data to the database. Im on
OrientDB 2.1.2
and the latestPhpOrient
. I am also usingUbuntu 14 (x64)
withPHP 5.5
Here's the test schema:
Executing the following truncates the number
PS - I've tried inserting data from the Studio and precision was fine. Therefore, I think there's something inside the library which is causing number to round up.