[AccessD] Decimals Problem

James Button jamesbutton at blueyonder.co.uk
Wed Sep 16 16:37:37 CDT 2015


Yep - 
Round, truncate, use float, or use currency ( 4 decimals) or use integer and
your own calculation of number of places to generate 
As in assume 4 places times 4 places - with the values each  incremented by 10^4
then reduce the result by truncating by 4 digit and then rounding with a divide
by 10^4 to get the value with just 4 decimals 

But there are still decisions to be made as to the accuracy of the values to be
used, the accuracy of the intermediate answers and the rounding etc to be
applied to what stages of the calculations.

That's what customer meetings are for - annoying them and getting commitments
from them as to what errors are to be incorporated into the workings of their
system.

They specified it, you coded it that way, so it ain't your mistake!

JimB 

-----Original Message-----
From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky
Smolin
Sent: Wednesday, September 16, 2015 10:21 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Decimals Problem

So I changed the conversion factor to 2.5400000025908 but now it calculates
the quantity as 127000.00012954	

Calculation is float*float (double*double) 

r

-----Original Message-----
From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
James Button
Sent: Wednesday, September 16, 2015 1:45 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Decimals Problem

Maybe currency 15 digits + 4 decimal and do not have a (visibly displayed)
currency symbol.

Re the arithmetic conversion factor with just 2 digits ?? and result to 4
digits of accuracy 

1 cm = 0.393700787 inches
Or 1 inch = 2.5400000025908 cm

So 5,000,000 inches = 12700000.01295 cm
   Or is it
You does-your-calculation and takes the answer from float*float or currency
* currency 5,000,000.0000*2.5400 = 12,700,000.0000
:-)
;-(

JimB

-----Original Message-----
From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
Rocky Smolin
Sent: Wednesday, September 16, 2015 9:17 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Decimals Problem

Further to the problem - I found out that the problem is in the purchase
order receiving where there is a conversion from inches to centimeters.
Receiving 50,000 inches with a conversion factor of 2.54 should yield
127,000 cm received, but it actually yields 126999.998092651. 

Unfortunately we don’t have the option of rounding up to the integer.  The
user wants to have 4 decimal places accuracy.  But 126,999.9981 is not what
he want to see as being received - it's actually not correct.

If he received for example 5 inches that would be 12.7 cm - he wouldn't want
to see 13 cm being received.

BTW the quantity received and the conversion factors are both Double data
type.

I don't see a quick way around this but any suggestions welcome.

MTIA

Rocky


-----Original Message-----
From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
Rocky Smolin
Sent: Wednesday, September 16, 2015 9:33 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Decimals Problem

Yeah, that would be too easy.  Actually the
piece/carton/case/pallet/truckload thing is handled in the bill of
materials.  This problem is a real genuine decimal fraction that I think
cannot be handled in binary.

The bigger problems is, even if I could get the number 1.23456789 to display
with only four places - 1.2346 - when I click into the text box it displays
1.23456789.  This in not a problem for anyone but this user does NOT want to
see those extra places.

R


-----Original Message-----
From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
James Button
Sent: Wednesday, September 16, 2015 9:24 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Decimals Problem

Maybe the quantity is 'cases' or wraps, in which case should the app include
an indication of the quantity per wrap, and an additional value being shown
as number of 'pieces' from a wrap As in buy in in 1000's - case and sell in
12's So 1 in = 83 (12's) +  4 

Maybe the option you could possibly use for display  being
83+4/12

JimB

-----Original Message-----
From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
Rocky Smolin
Sent: Wednesday, September 16, 2015 4:18 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Decimals Problem

The unbound text box is definitely an option although a bit awkward.  We
have also to allow the user to specify the number of decimal places they
want.  

I've got a telecon with this user this evening - they're in Singapore. I'll
try to nail down a little better exactly what they want.

Thanks

R


-----Original Message-----
From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
Gustav Brock
Sent: Wednesday, September 16, 2015 8:04 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Decimals Problem

Hi Rocky

If you don't need the exact value for further calculations, round it
permanently to two decimals. I recently posted a link to all my rounding
functions.

If you need the value as is, you may consider having an unbound textbox
displaying the rounded value. When you update this, update the bound field.

/gustav

-----Oprindelig meddelelse-----
Fra: AccessD [mailto:accessd-bounces at databaseadvisors.com] På vegne af Rocky
Smolin
Sendt: 16. september 2015 16:54
Til: 'Access Developers discussion and problem solving'
<accessd at databaseadvisors.com>
Emne: [AccessD] Decimals Problem

Dear List:
 
In an app there's a text box bound to a quantity on hand field.  Sometimes
there is no exact equivalent in hex of a decimal fraction value.  So instead
of showing 150 the box shows 149.998475.  There is a user-specified
preference in a table specifying the number of decimal places to display.  
 
Problem 1: If I set this in the property sheet instead of through code in
the _Open event, it works.  Setting the .DecimalPlaces property in code does
not work in the case of 149.998475.
 
Problem 2: Even if I can get the number to display as 150 by setting the
.DecimalPlaces property to zero, when I click into the text box the number
changes from 150 to display 149.998475.
 
Problem 3, the user I think will want one or two decimal places to show
wherever quantity on hand shows in the app - but not sure.  Maybe they'll
buy off on zero places.
 
Any leads on how to solve this greatly appreciated.
 
MTIA
 
Rocky 

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list