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

import java.io.*; public class ArrayApp{ public static void main(String[] args){ System.out.println(lllll); } // end
On my system I can't run a simple Java application that start a process.
Just wondering if anybody has run Scala app or web-app on Java Real-Time system?
I've been wondering why do some languages, such as Java run on Both Linux
is it possible to run java app on linux (with installed java and etc)
I run a Java code with the following command: $ java -Xms4G -Xmx4G myjavacode
Can I run a Java applet that's been embedded in an or HTML tag
I need to run a java application (not an applet or JNLP, but a
I cannot get a Java application to run correctly when starting it with sudo.
Possible Duplicate: Detect if Java application was run as an admin How do I

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.