+ Reply to Thread
Results 1 to 21 of 21

MATH: FLOOR, CEILING, MROUND functions: fails with extreme values.

  1. #1
    Registered User
    Join Date
    05-14-2024
    Location
    Hamburg, Germany
    MS-Off Ver
    ver. 2010, 64-bit on Win7 64-bit SP2
    Posts
    14

    MATH: FLOOR, CEILING, MROUND functions: fails with extreme values.

    hello all,

    I have some questions about handling of values and simple formulas in Excel.
    I see some differences to what's defined / announced, alas my version of Excel is rather old,
    thus also info if the issues are improved in the meantime are welcome.

    FLOOR function: Microsoft announces on the site defining the function:
    support microsoft com en-us office floor-function
    'Rounds number down, toward zero, to the nearest multiple of significance.'

    but plenty of tasks with extreme values fail, e.g.:
    floor( -9E-307, -0.1 ) -> #NUM!,
    floor( -9E-307, 0.1 ) -> #NUM!,
    floor( 9E-307, 0.1 ) -> #NUM!,

    I consider that a break in math logic and assume some users / calculations might become
    trapped / harmed.

    Any clue behind that?

    Pls. no answers like to avoid such calculations, I can once I know about and am 'steady aware',
    other users or calculations in complex sheets / formulas can't.
    I'm just curious why it is as it is, and if improved in newer versions.

    TIA for any help.
    Last edited by newbie-02; 05-19-2024 at 04:48 AM. Reason: completed title to cover other functions

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,416

    Re: MATH: FLOOR function: fails with extreme values.

    It's probably down to floating point arithmetic.. but it's just a guess.

    https://learn.microsoft.com/en-gb/of...ccurate-result
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,416

    Re: MATH: FLOOR function: fails with extreme values.

    No. Ignore that. All 3 work perfectly for me, using O365.

  4. #4
    Registered User
    Join Date
    05-14-2024
    Location
    Hamburg, Germany
    MS-Off Ver
    ver. 2010, 64-bit on Win7 64-bit SP2
    Posts
    14

    Re: MATH: FLOOR function: fails with extreme values.

    Thanks to Glenn Kennedy,

    > It's probably down to floating point arithmetic.. but it's just a guess.

    _assume_ in old versions it's coded as simple 'divide - truncate - multiply' what can't work
    in limited datatypes for big spread number - significance.

    > No. Ignore that. All 3 work perfectly for me, using O365.

    Thanks, that was the info I wanted, first to see that Microsoft is making progress, and then
    to avoid embarrassing myself elsewhere in my work with outdated info.

  5. #5
    Registered User
    Join Date
    05-14-2024
    Location
    Hamburg, Germany
    MS-Off Ver
    ver. 2010, 64-bit on Win7 64-bit SP2
    Posts
    14

    Re: MATH: FLOOR function: fails with extreme values.

    sorry, I made a mistake, I wanted to ask if

    floor( -9E+307, -0.1 ),
    floor( -9E+307, 0.1 ), and
    floor( 9E+307, 0.1 ) have meaningful numerical results or -> #NUM! ?

  6. #6
    Registered User
    Join Date
    05-14-2024
    Location
    Hamburg, Germany
    MS-Off Ver
    ver. 2010, 64-bit on Win7 64-bit SP2
    Posts
    14

    MATH: FLOOR function: fails with extreme values.

    hello all,

    sorry I had a fail / typo when first asking this, thus again:

    I have some questions about handling of values and simple formulas in Excel.
    I see some differences to what's defined / announced, alas my version of Excel is rather old,
    thus also info if the issues are improved in the meantime are welcome.

    FLOOR function: Microsoft announces on the site defining the function:
    support microsoft com en-us office floor-function
    'Rounds number down, toward zero, to the nearest multiple of significance.'

    but plenty of tasks with extreme values fail, e.g.:
    floor( -9E+307, -0.1 ) -> #NUM!,
    floor( -9E+307, 0.1 ) -> #NUM!,
    floor( 9E+307, 0.1 ) -> #NUM!,

    I consider that a break in math logic and assume some users / calculations might become
    trapped / harmed.

    Any clue behind that?

    Pls. no answers like to avoid such calculations, I can once I know about and am 'steady aware',
    other users or calculations in complex sheets / formulas can't.
    I'm just curious why it is as it is, and if improved in newer versions.

    TIA for any help.

  7. #7
    Registered User
    Join Date
    05-14-2024
    Location
    Hamburg, Germany
    MS-Off Ver
    ver. 2010, 64-bit on Win7 64-bit SP2
    Posts
    14

    Re: MATH: FLOOR function: fails with extreme values.

    hello at AliGW,

    would have been better to delete this thread and let the other one open, this has a typo and sends users
    to nirvana.

    Am I allowed to ask similar questions about other functions? There are some more with questionable results,
    I thought to handle separately. ok?

  8. #8
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,416

    Re: MATH: FLOOR function: fails with extreme values.

    Just post here.

  9. #9
    Registered User
    Join Date
    05-14-2024
    Location
    Hamburg, Germany
    MS-Off Ver
    ver. 2010, 64-bit on Win7 64-bit SP2
    Posts
    14

    Re: MATH: FLOOR function: fails with extreme values.

    ok,

    floor( -9E+307, -0.1 ),
    floor( -9E+307, 0.1 ), and
    floor( 9E+307, 0.1 ) have meaningful numerical results or -> #NUM! ?

    note 9E !!!PLUS!!! 307 ...

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    82,445

    Re: MATH: FLOOR function: fails with extreme values.

    Quote Originally Posted by newbie-02 View Post
    would have been better to delete this thread and let the other one open, …
    No, it wouldn’t. Just ask your questions here - if members wish to help, they will. Do not open duplicate threads - they are not allowed. We do not shut down the original thread that has already had responses.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  11. #11
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,912

    Re: MATH: FLOOR function: fails with extreme values.

    Recall that 1.8E+308 limitation for calculated values from the other thread? That limitation is not just an Excel limitation, but a limitation of double precision floating point numbers across almost all programming languages. Any language that uses double precision will be limited to values smaller than 1.8E+308 anywhere in those double precision calculations. After some testing, I notice that the shift from result to #NUM error occurs right about 1.8E+307. What I would guess is happening is that somewhere in Excel's code for the FLOOR(x,y) function, it performs an x/y division operation. In the case of 9E+307/1E-1, the result of that operation will be 9E+308, which is larger than double precision can store, resulting in an overflow error. Excel then chooses to output a #NUM error to represent the overflow.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  12. #12
    Registered User
    Join Date
    05-14-2024
    Location
    Hamburg, Germany
    MS-Off Ver
    ver. 2010, 64-bit on Win7 64-bit SP2
    Posts
    14

    Re: MATH: FLOOR function: fails with extreme values.

    at MrShorty,

    yes, I do, and also assume that the root cause,

    If your description is still valid you are also on an old ver. of Excel?

    think to gain math / definition compatibility such could be substituted by a simple decision
    instead of calculating to not representable numbers, but didn't know if modern Excel would
    apply such or perform the hopeless calculation.

    Assume similarly you still have:

    ceiling( -9E+307, -0.1 ),
    ceiling( -9E+307, 0.1 ),
    ceiling( 9E+307, 0.1 ), and

    mround( -9E+307, -0.1 ),
    mround( 9E+307, 0.1 ) -> #NUM! ?

    And am curious if it's still the same on more recent versions.

  13. #13
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    82,445

    Re: MATH: FLOOR function: fails with extreme values.

    Please Login or Register  to view this content.
    Same in Excel 365.

  14. #14
    Registered User
    Join Date
    05-14-2024
    Location
    Hamburg, Germany
    MS-Off Ver
    ver. 2010, 64-bit on Win7 64-bit SP2
    Posts
    14

    Re: MATH: FLOOR function: fails with extreme values.

    nasty, user trapping, inconsistent, mathematically wrong, not matching the definitions, and in coding easy to avoid by a test:

    Please Login or Register  to view this content.
    anyone in a position to recheck, and / or propose to microsoft?
    Last edited by newbie-02; 05-19-2024 at 04:26 AM. Reason: prettyfying code

  15. #15
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    82,445

    Re: MATH: FLOOR function: fails with extreme values.

    Test what?

    Anyone can make suggestions to MS via their own website. There is no affilition with MS here on the forum, in case that's what you were supposing.

  16. #16
    Registered User
    Join Date
    05-14-2024
    Location
    Hamburg, Germany
    MS-Off Ver
    ver. 2010, 64-bit on Win7 64-bit SP2
    Posts
    14

    Re: MATH: FLOOR function: fails with extreme values.

    hello MrsAliAlwaysOnline :-)

    tried to contribute to MS several times in the past, simply ignored, thought here could read people either related to MS or
    having contacts / better reputation there ... if not this will stay secret useless knowledge for forum members ...

    > Test what

    if that test in MS code would work as intended.
    Last edited by newbie-02; 05-19-2024 at 04:44 AM. Reason: add info

  17. #17
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    82,445

    Re: MATH: FLOOR, CEILING, MROUND functions: fails with extreme values.

    hello MrsAliAlwaysOnline :-)
    Er - no, not always online!!! Logged in, yes, but it doesn't always mean that I am actually here. And I'm not sure why you felt the need to say this.

    thought here could read people either related to MS or
    having contacts / better reputation there
    Not to my knowledge.

  18. #18
    Registered User
    Join Date
    05-14-2024
    Location
    Hamburg, Germany
    MS-Off Ver
    ver. 2010, 64-bit on Win7 64-bit SP2
    Posts
    14

    Re: MATH: FLOOR, CEILING, MROUND functions: fails with extreme values.

    > felt the need to say this

    The more nonsense I find in binary floating point arithmetic and its applications, the more humor aside I need to keep my spirits up.

    IMHO we and Excel try to do some kind of math, and a relevant part of math is 'closedness', to produce either the defined results,
    or a meaningful ERR-notice, NOT! wrong results.

    In hope MS does care for forums as feedback, and as question at others to check with more recent versions:

    '=trunc(2.25E-308, 32768 )' -> 0 ???

    '=roundup(2.25E-308, 32768 )' -> 0 ???

    '=round(2.5, 2147483648 )' -> 0 ???

    To understand: it's not that I want, need or plan to calculate such tasks, but I'm looking
    where bin-FP errors evolve from, see risks in complex formulae where tasks are calculated
    which no human is controlling, and have trouble with other systems who claim to need to
    continue such nonsense reg. 'Excel compatibility'.

    TIA for any recheck :-)

  19. #19
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,912

    Re: MATH: FLOOR, CEILING, MROUND functions: fails with extreme values.

    Are you looking for something at this level of detail? This is from 1991 (when Excel was still a minor player in spreadsheet and computer programming spaces) and goes into great detail about how computers calculate using floating point data types: https://docs.oracle.com/cd/E19957-01..._goldberg.html

    Maybe you will also find this interesting: https://en.wikipedia.org/wiki/Floating-point_arithmetic
    And this article on the IEEE standardization of floating point arithmetic so that, even if computers were unable to perform certain calculations, they would at least be consistent. Somewhere I remember reading something that documented some of the ways that Excel adheres to and deviates from the IEEE standard. https://en.wikipedia.org/wiki/IEEE_754
    Finally, here's a Wikipedia article on floating point in Excel: https://en.wikipedia.org/wiki/Numeri...icrosoft_Excel
    Last edited by MrShorty; 05-19-2024 at 07:55 PM. Reason: added missing link

  20. #20
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    82,445

    Re: MATH: FLOOR, CEILING, MROUND functions: fails with extreme values.

    In hope MS does care for forums as feedback,
    If you mean THIS forum, then once again, there is no affiliation between us and MS, so they won't be looking at us.

  21. #21
    Registered User
    Join Date
    05-14-2024
    Location
    Hamburg, Germany
    MS-Off Ver
    ver. 2010, 64-bit on Win7 64-bit SP2
    Posts
    14

    Re: MATH: FLOOR, CEILING, MROUND functions: fails with extreme values.

    at MrShorty, thank you, yes, know these articles, think contributed to those on wikipedia, but my question here isn't what
    IEEE can do, but what a programmer can / should do with it. IEEE isn't defining a new math, it just has shortcomings, and
    it is the responsibility of the programmer to choose e.g. rounding modes or 'well conditioned formulas' to achieve his, his
    customers or our goals.

    In that sense I think that while we face some lack of precision in 'last bits', it is! possible to calculate results
    ( nearly ) matching Excels definitions also for most extreme cases, and I'm curious if
    - it's still not done in recent versions?
    - there is any other 'why' that I'm not aware of?
    - I'm the only idiot on this planet seeing a break in consistency and risks for unwary users ...

    To cite from 'Goldberg' he condems '... then the result of further operations will depend on the hidden digits and
    appear unpredictable to the user.' as bad behavior which I second to. And returning results not matching the
    own definition is - IMHO - also unpredictable and user trapping.

    To - try to - put in in simplier words, IMHO it's different things:
    - to have small imprecision in results due to imprecise binary deputies or rounding,
    - to have questionable definitions for functions ( that will be the next question ), or
    - not fulfilling / matching the definitions and returning mathematically wrong results
    to 'simple minded users'.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Issues with FLOOR.MATH
    By enough in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-24-2017, 06:22 PM
  2. How to This Command: Math.Floor
    By Sympathetic in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 01-01-2015, 02:05 PM
  3. secondary axis for extreme values
    By silviario in forum Excel General
    Replies: 1
    Last Post: 10-19-2011, 09:59 AM
  4. Replies: 5
    Last Post: 05-13-2009, 06:05 AM
  5. [SOLVED] floor function
    By srroduin in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-12-2006, 05:15 PM
  6. Replies: 3
    Last Post: 02-16-2006, 07:00 AM
  7. [SOLVED] How can I minimalize the difference between extreme values on a c.
    By kitkat in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 04-10-2005, 05:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1