Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6164237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:57:35+00:00 2026-05-23T21:57:35+00:00

There are probably hundreds of questions on here about floating point rounding errors, and

  • 0

There are probably hundreds of questions on here about floating point rounding errors, and the solution is supposed to be interval arithmetic which helps keep track of them. As I’d like to experiment with this, I tried installing pyinterval.

Unfortunately, it doesn’t seem to be working. For this trivial case of floating point error, I’d expect an interval with 2 numbers, one higher and one lower than the actual answer (0.001):

>>> from interval import interval
>>> interval(1.001)-1
interval([0.0009999999999998899])

After some head scratching, my best guess was that the number 1.001 is being converted to a single floating point value before being passed to the interval module, so I tried using the floating point fpu.up and fpu.down functions to force the conversion:

>>> from interval import fpu
>>> fpu.down(lambda : float("1.001")-1)
0.0009999999999998899
>>> fpu.up(lambda : float("1.001")-1)
0.0009999999999998899

Any idea what is wrong? Or have I got the wrong end of the stick on how this is supposed to work?

I’m using an x86 mac with “Python 2.7.1 (r271:86832, Jan 1 2011, 22:28:41) [GCC 4.2.1 (Apple Inc. build 5664)] on darwin”

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T21:57:36+00:00Added an answer on May 23, 2026 at 9:57 pm

    It looks like the conversion of strings to floats is not respecting the rounding, but if I do it manually by entering 1.001 as 1001/1000, I get the sort of thing I am expecting:

    >>> (interval[1001]/1000)-1
    interval([0.0009999999999996678, 0.001000000000000112])
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new with Objective-C, so there probably is a simple solution to this. I
There is probably a simple solution to this problem I've been having all night.
First of all, I know there are a few other StackOverflow questions about this
I still have a large number of floppies. On some of them there probably
There is probably is simple fix for this but I currently have code similar
I'm not too good with SQL and I know there's probably a much more
I'm using .Net 2.0 and this is driving me crazy but there's probably some
I'm new to the OOP paradigm, so there's probably a simple explanation for this
I was searching Google for a page offering some simple OpenMp algorithms. Probably there
I've created a salt using; md5(rand(0,10000000)); (there is probably a better way?) There doesn't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.