Python Forum
ln2 value is _math.c (cpython)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ln2 value is _math.c (cpython)
#5
I think the answers you got from stackoverflow are correct. The hard coded value is not log(2) but log(2) truncated to the ieee754 representation on presumably 64 bits.

Concerning wolfram alpha's result here is what python says
>>> from math import log
>>> x = 0.6931471805599453094172321214581
>>> x == log(2)
True
>>> y = 6.93147180559945286227E-01
>>> y == log(2)
True
so there is no difference in ieee754 representation on 64 bits.
Reply


Messages In This Thread
ln2 value is _math.c (cpython) - by matanya_stroh - Feb-06-2018, 02:44 PM
RE: ln2 value is _math.c (cpython) - by Larz60+ - Feb-06-2018, 07:44 PM
RE: ln2 value is _math.c (cpython) - by Larz60+ - Feb-06-2018, 08:01 PM
RE: ln2 value is _math.c (cpython) - by Gribouillis - Feb-06-2018, 08:14 PM
RE: ln2 value is _math.c (cpython) - by buran - Feb-06-2018, 08:19 PM
RE: ln2 value is _math.c (cpython) - by Gribouillis - Feb-06-2018, 08:47 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [CPython] Can't run script python VietVH 2 1,279 May-21-2022, 04:49 PM
Last Post: VietVH
  ImportError: /home/ali/Documents/test/charm/core/crypto/AES.cpython-39-x86_64-linux-g Anldra12 0 1,304 Apr-28-2022, 07:13 AM
Last Post: Anldra12
  Reducing runtime memory usage in Cpython interpreter david_the_graower 2 2,336 Oct-18-2021, 09:56 PM
Last Post: david_the_graower
  Navigating cpython source using python quazirfan 3 2,106 Aug-09-2021, 07:52 PM
Last Post: quazirfan
  IronPython from CPython amasis 3 2,351 Feb-05-2021, 12:26 PM
Last Post: jefsummers
  ImportError: /home/pybind11_example.cpython-37m-x86_64-linux-gnu.so: undefined symbol chaitra 2 5,269 Feb-03-2021, 05:14 AM
Last Post: chaitra
  compiled cpython output wrong version bigrockcrasher 0 1,554 Feb-25-2020, 06:31 PM
Last Post: bigrockcrasher
  CPython: Knowing when the interpreter expects more input b0bh00d 1 2,177 Apr-18-2019, 05:08 PM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020