Re: access 97 floor function

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Gary Walter (garylwpleasenospam_at_wamego.net)
Date: 04/21/04


Date: Wed, 21 Apr 2004 06:00:56 -0500

Just for the record (and meaning no offense),

Works:
--------------
? (int(12.1234 / .1) * .1)
 12.1
? (int(12.1799 / .1) * .1)
 12.1

Unexpected Results:
---------------------
? (int(12.0 / .1) * .1)
 11.9
? (int(12.0000000000000001 /.1) * .1)
 11.9

One option (for Access versions that support CDec()):
------------------------------------------------------
? (int(CDec(12.0) /CDec(.1)) * CDec(.1))
 12
? (int(CDec(12.0000000000000001) /CDec(.1)) * CDec(.1))
 12

You may only need to use CDec in division

? (int(CDec(12.1234) /CDec(.1)) * .1)
 12.1
? (int(CDec(12.199999) /CDec(.1)) * .1)
 12.1
? (int(CDec(12.09999) /CDec(.1)) * .1)
 12
? (int(CDec(12.0000000000000001) /CDec(.1)) * .1)
 12

but you might use var in FLOOR function
to change Precision to Dec, then could use
var in both places.

I believe it is only the division and subtraction
of non-integers where this is a problem. To make
sure I'm not wrong, it would not hurt to read:

When Access Math Doesn't Add Up
by Luke Chung President of FMS
http://www.fmsinc.com/tpapers/math/index.html

Again, meaning no offense.

Gary Walter

"MGFoster" <me@privacy.com> wrote in message
news:QShhc.2674$eZ5.1684@newsread1.news.pas.earthlink.net...
> Marv wrote:
>
> > Can I duplicate the floor function in Excel in Access 97?
> > I need to round down to the nearest tenth.
> > example 12.1234 to 12.1
> > 12.1799 to 12.1
>
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> This is a function I obtained from MS's NeatCode97.mdb example file:
>
> Function Floor(N, ByVal Precision)
> '
> ' Similar to Excel's Floor function
> ' Rounds down (toward zero) to the next higher level of precision.
> ' Precision cannot be 0.
> '
> Precision = Abs(Precision)
> Floor = Int(N / Precision) * Precision
> End Function
>
> --
> MGFoster:::mgf00 <at> earthlink <decimal-point> net
> Oakland, CA (USA)
>
> -----BEGIN PGP SIGNATURE-----
> Version: PGP for Personal Privacy 5.0
> Charset: noconv
>
> iQA/AwUBQIWqN4echKqOuFEgEQK4RgCdFM+GyrKQCNAdVpjoa4U8KFLi3A0AoKl0
> Vi461d0dg0fcAFg+mt4nBZ+G
> =UXYH
> -----END PGP SIGNATURE-----
>



Relevant Pages

  • Re: access 97 floor function
    ... No offense taken. ... > var in both places. ... > Again, meaning no offense. ... >>>Can I duplicate the floor function in Excel in Access 97? ...
    (microsoft.public.access.queries)
  • Re: Sloppy Reporting: Dietary Carbohydates and TGs
    ... There is often more than one clear cut definition, ... phrase to popularly come to have a meaning the reverse of the original. ... Precision in meaning or pointless hair-splitting. ... recorded law or Cruel law. ...
    (alt.support.diabetes)
  • Re: Legal Principle
    ... Contract law requires precision in the use of language. ... will be buggerd when it comes to the legal test of any ... Consider the use of the word "untaken" - meaning what, ...
    (uk.legal)
  • Re: Can You BELIEVE This?
    ... went on an unholy crusade to stop meaningless offense whereever it might ... it is to maintain the original meaning of a term while ... dealing with sexual and eliminative processes. ... an entire race. ...
    (rec.arts.sf.tv.babylon5.moderated)