# Servoy Subtracting a Penny!

**URL:** <https://forum.servoy.com/t/servoy-subtracting-a-penny/4117>\
**Category:** Classic Servoy\
**Created:** [April 28, 2005, 3:03pm UTC](https://forum.servoy.com/t/servoy-subtracting-a-penny/4117 "2005-04-28T15:03:20Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![marko1](https://avatars.discourse-cdn.com/v4/letter/m/3d9bf3/32.png) [@marko1](https://forum.servoy.com/u/marko1)\
**Post date:** [April 28, 2005, 3:03pm UTC](https://forum.servoy.com/t/servoy-subtracting-a-penny/4117/1 "2005-04-28T15:03:20Z")

</div>

I have encountered a serious Servoy bug.

BUG: When entering a price into a number field, Servoy is subtracting a penny! I enter 10.00 and 9.99 goes into the database. This field is a “number” field in Servoy, mapped to a “decimal (3,2)” field in mySQL 4.1.9. I have tried making the decimal field in mySQL “decimal (3,3)”, when I do this, the value that goes in is 9.999. I have also tried adding formatting to the field on the layout (#,###.00)

No luck.

I realize a penny is not much, but it is completely unacceptable to my customers. I am forced to go back to FileMaker to enter data. This defeats the reason I bough Servoy to begin with.

Config:

Machine Model: Power Mac G5  
CPU Type: PowerPC G5 (2.2)  
Number Of CPUs: 2  
CPU Speed: 2 GHz  
L2 Cache (per CPU): 512 KB  
Memory: 2 GB  
Bus Speed: 1 GHz  
Boot ROM Version: 5.1.8f7  
Serial Number: G84470HSQPR

System Software Overview:

System Version: Mac OS X 10.3.9 (7W98)  
Kernel Version: Darwin 7.9.0  
Boot Volume: MasDev\_HD  
Computer Name: MasDev Command Center  
User Name: Mark A Suppes (marksuppes)

Servoy Developer  
Version R2 2.2rc6-build 324  
Java version 1.4.2-38 (Mac OS X)

MySQL 4.1.9-max-log

Mark A Suppes

MasDevelopment  
Vice-President NY FileMaker Developers’ Group

---

<div class="post-metadata">

**Author:** ![Thunder](https://avatars.discourse-cdn.com/v4/letter/t/a8b319/32.png) [@Thunder](https://forum.servoy.com/u/Thunder)\
**Post date:** [May 4, 2005, 9:53pm UTC](https://forum.servoy.com/t/servoy-subtracting-a-penny/4117/2 "2005-05-04T21:53:05Z")

</div>

Hi Mark

I have a solution which uses Sybase for stock management. There is a method which adds stock items to a mysql database to drive a website. This includes prices. I saw your post and thought I’d check my solution. In my test, If I add 100.00, 100.00 goes into sybase, if I then execute the script to add the related mysql record, 100.00 goes into that (verified IN MySQL) I also tried with other arbitrary values… Simply because I have a similar solution, I was able to test this and can’t reproduce your problem (for reference, my machine specs are identical, a dual 2.0Ghz G5 running 10.3.9, Servoy 2.2rc6 AND my MySQL prices are formatted as decimal… Works perfect here. Must be something in your coding ![;)]( "Wink")

---

<div class="post-metadata">

**Author:** ![automazione](https://avatars.discourse-cdn.com/v4/letter/a/8797f3/32.png) [@automazione](https://forum.servoy.com/u/automazione)\
**Post date:** [May 5, 2005, 8:37pm UTC](https://forum.servoy.com/t/servoy-subtracting-a-penny/4117/3 "2005-05-05T20:37:50Z")

</div>

Hi Mark,

as Thunder says, probably there must be something wrong in your code, I’ve got a lot of different Servoy solutions with different numeric fields and calculations.. and all of them works as expected, with NO unpredictable/unwanted penny discrepancy!!!

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [May 9, 2005, 8:46am UTC](https://forum.servoy.com/t/servoy-subtracting-a-penny/4117/4 "2005-05-09T08:46:50Z")

</div>

what happens if you just make the field through servoy?  
So make a NUMBER field and store the data in that.

---

<div class="post-metadata">

**Author:** ![marko1](https://avatars.discourse-cdn.com/v4/letter/m/3d9bf3/32.png) [@marko1](https://forum.servoy.com/u/marko1)\
**Post date:** [October 7, 2005, 8:40pm UTC](https://forum.servoy.com/t/servoy-subtracting-a-penny/4117/5 "2005-10-07T20:40:09Z")

</div>

Thanks you for the feedback. Unfortunately, I am still having this problem. I don’t think this is a problem with “my coding” since there isn’t really any code going on here. It’s just a decimal (10,2) field in mySQL, with a servoy field mapped to it. There is no javascrip or anything like that. I am just using servoy as a front end for data entry.

I’ve noticed that the problem only happen with certain values, such as .09  
for example, but not .07

---

<div class="post-metadata">

**Author:** ![coulombre](https://avatars.discourse-cdn.com/v4/letter/c/34f0e0/32.png) [@coulombre](https://forum.servoy.com/u/coulombre)\
**Post date:** [October 7, 2005, 9:24pm UTC](https://forum.servoy.com/t/servoy-subtracting-a-penny/4117/6 "2005-10-07T21:24:41Z")

</div>

Hi Mark,

Tried it on my setup here that is almost identical to the one your describe. However it is working properly here.

Very curious behavior… it will be interesting to find out what the problem is.

Best,

Rich Coulombre

---

<div class="post-metadata">

**Author:** ![JerryR](https://avatars.discourse-cdn.com/v4/letter/j/ad7895/32.png) [@JerryR](https://forum.servoy.com/u/JerryR)\
**Post date:** [October 10, 2005, 4:57pm UTC](https://forum.servoy.com/t/servoy-subtracting-a-penny/4117/7 "2005-10-10T16:57:32Z")

</div>

Had a problem similar (but not identical) to this last year with MS SQL Server. (Problem involved a much higher precision.) Turned out to be the MS jdbc driver. Switched to the jtds driver and the problem went away.
