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 5969943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:18:12+00:00 2026-05-22T20:18:12+00:00

I am working on a VB.Net app running on .Net framework 2.0.50727.3603 When I

  • 0

I am working on a VB.Net app running on .Net framework 2.0.50727.3603

When I fire off this xquery statement I get 56, but would expect 55:

ceiling(.55*100)

I am only seeing weird results on .55 and .56 as you can see my results below:

ceiling(.50*100) = 50
ceiling(.51*100) = 51
ceiling(.52*100) = 52
ceiling(.53*100) = 53
ceiling(.54*100) = 54
ceiling(.55*100) = 56 (would expect 55)
ceiling(.56*100) = 57 (would expect 56)
ceiling(.57*100) = 57
ceiling(.58*100) = 58
ceiling(.59*100) = 59
ceiling(.64*100) = 64
ceiling(.65*100) = 65
ceiling(.66*100) = 66

Any ideas on what might be causing this? Is this a bug in xquery?

Here is the basic gist of my code:

Imports System.Xml
Dim objXPathNavigator As XPathNavigator
evaluateExpression = objXPathNavigator.Evaluate(objXPathExpression)
  • 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-22T20:18:13+00:00Added an answer on May 22, 2026 at 8:18 pm

    XSLT/XPath 1.0 has a single number type, a double precision floating point type that is the same as the VB.NET Double. If you run

    Dim doubleArray As Double() = {0.5, 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59}
    For Each d As Double In doubleArray
        Console.WriteLine("d: {0}; d * 100: {1}; Math.Ceil(d * 100): {2}", d, d * 100, Math.Ceiling(d * 100))
    Next
    

    with .NET you will find similar oddities to the one you find with your XPath evaluation.

    So the problem is the limited precision of that number type in XPath 1.0 (or other languages), the decimal representation (e.g. 0.55) is finite but the binary representation might not be. If you need better precision you need to consider to move to XPath 2.0, currently only supported by third party products like Saxon 9 or XQSharp, there you can then use the xs:decimal type instead of the number type.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Some Details I am working with VisualWebGUI, so this app is like ASP.NET, and
Im working on an ASP.Net app with c#. I am stuck on a problem
I'm working on a .NET WinForms app that needs to print a FEDEX shipping
I've been working on a web crawling .NET app in my free time, and
I am working on a ASP.NET app and i have a need to post
I’m working on trying to port an ASP.NET app from Server 2003 (and IIS6)
The ASP.NET web app project I'm currently working on is getting slower over time
I am working on a VB.NET WinForms app that was upgraded by Visual Studio
I am working on an existing ASP.NET MVC app that started small and has
I'm working on a asp.net mvc2 app. I have been using jquery to do

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.