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

  • Home
  • SEARCH
  • 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 895087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T14:30:11+00:00 2026-05-15T14:30:11+00:00

In Java I run: System.out.println(Math.log(249.0/251.0)); Output: -0.008000042667076265 In C# I run: <- fixed Math.Log

  • 0

In Java I run:

System.out.println(Math.log(249.0/251.0));

Output: -0.008000042667076265

In C# I run: <- fixed

Math.Log (x/y); \\where x, y are almost assuredly 249.0 and 251.0 respectively

Output: -0.175281838 (printed out later in the program)

Google claims:

Log(249.0/251.0)

Output: -0.00347437439

And MacOS claims about the same thing (the first difference between google and Snow Leopard is at about 10^-8, which is negligible.

Is there any reason that these results should all vary so widely or am I missing something very obvious? (I did check that java and C# both use base e). Even mildly different values of e don’t seem to account for such a big difference. Any suggestions?

EDIT:

Verifying on Wolfram Alpha seems to suggest that Java is right (or that Wolfram Alpha uses Java Math for logarithms…) and that my C# program doesn’t have the right input, but I am disinclined to believe this because taking (e^(google result) – 249/251) gives me an error of 0.0044 which is pretty big in my opinion, suggesting that there is a different problem at hand…

  • 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-15T14:30:12+00:00Added an answer on May 15, 2026 at 2:30 pm

    You’re looking at logarithms with different bases:

    • Java’s System.out.println(Math.log(249.0/251.0)); is a natural log (base e)
    • C#’s Math.Log (x,y); gives the log of x with base specified by y
    • Google’s Log(249.0/251.0) gives the log base 10

    Though I don’t get the result you do from C# (Math.Log( 249.0, 251.0) == 0.998552147171426).

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

Sidebar

Related Questions

We have a Java program run as root on Unix, that therefore can read
Always when I run java application it will display in Windows Task Manager is
I have a piece of server-ish software written in Java to run on Windows
The code at the end produces a compile error: NotApplicable.java:7: run() in cannot be
I am looking for the best way to make my desktop java program run
I'm using firefox3 to run a Java Applet (on Linux). normally, when the JVM
When would you call Java's thread.run() instead of thread.start() ?
I am trying to run a java based tool using a command line syntax
I am looking for the best method to run a Java Application as a
I am getting a NoClassDefFoundError when I run my Java application. What is typically

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.