Author Topic: Tech.jpg  (Read 38306 times)

0 Members and 1 Guest are viewing this topic.

Online CarbShark

  • Poster of Extraordinary Magnitude
  • **********
  • Posts: 11954
Re: Tech.jpg
« Reply #330 on: February 12, 2019, 12:17:18 PM »
When one adds 0.1 and 0.2 in Python, one gets 0.30000000000000004.

Is that Python or the processor?


Sent from my iPhone using Tapatalk
and Donald Trump is President of the United States.

I'm not a doctor, I'm just someone who has done a ton of research into diet and nutrition.

Offline werecow

  • Cryptobovinologist
  • Stopped Going Outside
  • *******
  • Posts: 5011
  • mooh
Re: Tech.jpg
« Reply #331 on: February 12, 2019, 01:08:41 PM »
When one adds 0.1 and 0.2 in Python, one gets 0.30000000000000004.

Is that Python or the processor?

Well, for readability, the python interpreter prints a rounded value for a float by default (17 significant decimals by default), which is less precise than the value that it has in memory, so a rounding error can occur there. The actual value for 0.1 + 0.2 is:

Quote
>>> from decimal import *
>>> Decimal(0.1 + 0.2)
Decimal('0.3000000000000000444089209850062616169452667236328125')

This is because, in actuality, the value of 0.1 is not really 0.1. In memory the closest representation possible with default double precision (53 "digit" bits plus 11 exponent bits) is:
Quote
>>> Decimal(0.1)
Decimal('0.1000000000000000055511151231257827021181583404541015625')
>>> Decimal(0.2)
Decimal('0.200000000000000011102230246251565404236316680908203125')

Ultimately though, this is a consequence of the internal representation of floating point numbers in the computer; you'd need an unlimited number of bits to represent an irrational number with perfect accuracy, for example. A float has a limited number of bits, so it can only represent a limited number of values (or, equivalently, represent a number with a limited amount of precision, i.e. a limited number of decimals). How much rounding error you get depends on the exact implementation of the calculations and of course the number of bits for a float (for example, small floating point errors are not usually problematic for visual rendering and may even aid neural network learning by preventing overfitting to some small degree, and so GPUs do less precise but much more heavily parallelized floating point calculations than a CPU). The details of the 0.1 + 0.2 error are given here (in the section on representation error). When you need it, you can get better precision in python, for example (I'm sure this can be accomplished in any other mature programming language), by using the decimal module, in which you can set the decimal precision to some arbitrary value (until you run out of hardware resources, of course).
« Last Edit: February 12, 2019, 01:36:28 PM by werecow »
Mooohn!

Offline The Latinist

  • Cyber Greasemonkey
  • Technical Administrator
  • Reef Tank Owner
  • *****
  • Posts: 8035
Re: Tech.jpg
« Reply #332 on: February 12, 2019, 01:30:48 PM »
When one adds 0.1 and 0.2 in Python, one gets 0.30000000000000004.
Is that Python or the processor?

Well, it's a result of the floating point precision of the calculation, which is dependent upon the language.  Other languages run on the same processor will give different results for the sum of 0.1 and 0.2, both with greater or lesser precision. Perl6, for instance, stores such decimals as quotients of 64-bit integers and so will give precise results for the calculation. The particular result 0.30000000000000004 is not unique to Python (C flavors, Java, and many others use the same default precision).

As werecow points out, one can use the decimal module if one wants arbitrary precision in Python.
I would like to propose...that...it is undesirable to believe in a proposition when there is no ground whatever for supposing it true. — Bertrand Russell

Online Noisy Rhysling

  • Stopped Going Outside
  • *******
  • Posts: 4879
    • Hyperwar, WWII in Hypertext.
Re: Tech.jpg
« Reply #333 on: February 12, 2019, 02:14:16 PM »
Three cheers for floating point arithmetic.
When I hear that referenced I flash on an arithmetic teacher floating face down in a bayou.
"Sunday's horoscope is note worthy because of its strange, sudden and wholly unpredictable and inexplicable occurrences, affecting all phases of life." Your Horoscope" L.A. Evening Herald Express, Sat, 12/06/41

Offline fred.slota

  • Keeps Priorities Straight
  • ***
  • Posts: 384
Re: Tech.jpg
« Reply #334 on: February 12, 2019, 02:36:13 PM »
Damn power-of-two representation of power-of-ten fractions.

This just goes to prove, computers are the work of satan.

If God wanted us to use computers, he would have given us a torso and a trunk (2 total), each having 2 arms/legs ending on 2 hands/feet (4 total), each with 2 opposing fingers (8 total) , each ending in 2 opposing thumbs (16 total).

Two side benefits:

1)  Arcade 4-tined claw machines would truly be the figurative representations of the "Hand of God" that they are.
2) Everyone would be "all thumbs"

Two drawbacks:

1) "Who's got 8 thumbs and likes to party?" memes
2) Males would have an advantage when having to count to 17.

Offline PANTS!

  • One leg at a time.
  • Poster of Extraordinary Magnitude
  • **********
  • Posts: 11992
  • What seals? I auditioned for this job.
Re: Tech.jpg
« Reply #335 on: February 12, 2019, 02:54:22 PM »

2) Males would have an advantage when having to count to 17.

I think you mean either 11 or 10,001
Now where I come from
We don't let society tell us how it's supposed to be
-Uptown, Prince 👉

The world is on its elbows and knees
It's forgotten the message and worships the creeds

Offline fred.slota

  • Keeps Priorities Straight
  • ***
  • Posts: 384
Re: Tech.jpg
« Reply #336 on: February 12, 2019, 03:45:03 PM »

2) Males would have an advantage when having to count to 17.

I think you mean either 11 or 10,001
Obviously, I was translating from the divine numerology to the more common ver-num-cular.

But, since you asked, I will point out that neither of those is correct.  The proper number would be "two octred and one" in base octred, 2110, or simply 21.  Bi-thumbery representation (10,0012 in this case) is used by computer professionals, but becomes unwieldly for large numbers in general use.  Natural counting of course uses all octred thumbs on your two hands.  Only heathens would base a counting system whose base requires the removal of one's shoes.

Offline Billzbub

  • Stopped Going Outside
  • *******
  • Posts: 4343
  • I know you know I know
Re: Tech.jpg
« Reply #337 on: February 12, 2019, 04:52:17 PM »
I wanted to make a picture with Neo's (from The Matrix) body with Pennywise the Clown's (from It) head with a caption of "We're all floats down here."  I just don't have the gumption to get up and do it.
Quote from: Steven Novella
gleefully altering one’s beliefs to accommodate new information should be a badge of honor

Offline werecow

  • Cryptobovinologist
  • Stopped Going Outside
  • *******
  • Posts: 5011
  • mooh
Re: Tech.jpg
« Reply #338 on: February 12, 2019, 04:53:28 PM »

2) Males would have an advantage when having to count to 17.

I think you mean either 11 or 10,001
Obviously, I was translating from the divine numerology to the more common ver-num-cular.

But, since you asked, I will point out that neither of those is correct.  The proper number would be "two octred and one" in base octred, 2110, or simply 21.  Bi-thumbery representation (10,0012 in this case) is used by computer professionals, but becomes unwieldly for large numbers in general use.  Natural counting of course uses all octred thumbs on your two hands.  Only heathens would base a counting system whose base requires the removal of one's shoes.
218 I assume? Also what's an octred?
Mooohn!

Offline fred.slota

  • Keeps Priorities Straight
  • ***
  • Posts: 384
Re: Tech.jpg
« Reply #339 on: February 13, 2019, 03:13:51 AM »

2) Males would have an advantage when having to count to 17.

I think you mean either 11 or 10,001
Obviously, I was translating from the divine numerology to the more common ver-num-cular.

But, since you asked, I will point out that neither of those is correct.  The proper number would be "two octred and one" in base octred, 2110, or simply 21.  Bi-thumbery representation (10,0012 in this case) is used by computer professionals, but becomes unwieldly for large numbers in general use.  Natural counting of course uses all octred thumbs on your two hands.  Only heathens would base a counting system whose base requires the removal of one's shoes.
218 I assume? Also what's an octred?
I was talking in character for a quad-claw.

Speaking out-of-character...

The natural base in any alternate universe is always base 10, it's just that not all 10s are created equal.  For human-base-10, the digits are 0, 1, 2, 3, 4, 5, 6, 7, 8 & 9 for a total of 9+1=10 digits.  For quad-claw-base-10 (or Simpsons-base-10), the digits are 0, 1, 2, 3, 4, 5, 6 & 7 for a total of 7+1=10 digits.  For Double-Captain-Hook-base-10, the digits are 0 & 1 for 1+1=10 digits.  For Octopus-hand-base-10, the digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E & F for F+1 = 10 digits.  Humans might call each of those base 10, 8, 2 and 16, respectively, but each of those people would natively call their own system base 10.

And what's an "octred"?  In our English base-10, we have names for the powers of 10; ten, hundred, thousand, ten thousand, etc.  I wanted to have an in universe name for the second power of 8 that was neither "eight" nor "ten" to more clearly establish that this was a different numbering system, so I merged an "octo-" with a "-red".  I nearly went with "octen", to pattern it as "octen", "octred", "octand", "octen octand", etc., but I wasn't sure if that would have been clear enough.  Apparently this still wasn't as clear as I thought it was.

Ah, well.  5 of one, half a drizzen of another.

Online Noisy Rhysling

  • Stopped Going Outside
  • *******
  • Posts: 4879
    • Hyperwar, WWII in Hypertext.
Re: Tech.jpg
« Reply #340 on: February 13, 2019, 05:51:32 AM »
This place is so weird.
"Sunday's horoscope is note worthy because of its strange, sudden and wholly unpredictable and inexplicable occurrences, affecting all phases of life." Your Horoscope" L.A. Evening Herald Express, Sat, 12/06/41

Offline fred.slota

  • Keeps Priorities Straight
  • ***
  • Posts: 384
Re: Tech.jpg
« Reply #341 on: February 13, 2019, 08:13:18 AM »
Talk to the quad-claw.

Offline werecow

  • Cryptobovinologist
  • Stopped Going Outside
  • *******
  • Posts: 5011
  • mooh
Re: Tech.jpg
« Reply #342 on: February 13, 2019, 08:35:15 AM »
I don't know what all the fuss is about. A numbering system with base two works just fine for my hooves.

Offline PANTS!

  • One leg at a time.
  • Poster of Extraordinary Magnitude
  • **********
  • Posts: 11992
  • What seals? I auditioned for this job.
Re: Tech.jpg
« Reply #343 on: February 13, 2019, 08:52:06 AM »

2) Males would have an advantage when having to count to 17.

I think you mean either 11 or 10,001
Obviously, I was translating from the divine numerology to the more common ver-num-cular.

But, since you asked, I will point out that neither of those is correct.  The proper number would be "two octred and one" in base octred, 2110, or simply 21.  Bi-thumbery representation (10,0012 in this case) is used by computer professionals, but becomes unwieldly for large numbers in general use.  Natural counting of course uses all octred thumbs on your two hands.  Only heathens would base a counting system whose base requires the removal of one's shoes.
218 I assume? Also what's an octred?
I was talking in character for a quad-claw.

Speaking out-of-character...

The natural base in any alternate universe is always base 10, it's just that not all 10s are created equal.  For human-base-10, the digits are 0, 1, 2, 3, 4, 5, 6, 7, 8 & 9 for a total of 9+1=10 digits.  For quad-claw-base-10 (or Simpsons-base-10), the digits are 0, 1, 2, 3, 4, 5, 6 & 7 for a total of 7+1=10 digits.  For Double-Captain-Hook-base-10, the digits are 0 & 1 for 1+1=10 digits.  For Octopus-hand-base-10, the digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E & F for F+1 = 10 digits.  Humans might call each of those base 10, 8, 2 and 16, respectively, but each of those people would natively call their own system base 10.

And what's an "octred"?  In our English base-10, we have names for the powers of 10; ten, hundred, thousand, ten thousand, etc.  I wanted to have an in universe name for the second power of 8 that was neither "eight" nor "ten" to more clearly establish that this was a different numbering system, so I merged an "octo-" with a "-red".  I nearly went with "octen", to pattern it as "octen", "octred", "octand", "octen octand", etc., but I wasn't sure if that would have been clear enough.  Apparently this still wasn't as clear as I thought it was.

Ah, well.  5 of one, half a drizzen of another.

I got it.
Now where I come from
We don't let society tell us how it's supposed to be
-Uptown, Prince 👉

The world is on its elbows and knees
It's forgotten the message and worships the creeds

Offline fred.slota

  • Keeps Priorities Straight
  • ***
  • Posts: 384
Re: Tech.jpg
« Reply #344 on: February 13, 2019, 08:56:15 AM »
Yeah, but you could just be that one in a megoct.

 

personate-rain
personate-rain