Significant digit computation time

  • Thread starter Thread starter Tone L
  • Start date Start date
  • Tags Tags
    Computation Time
AI Thread Summary
Performing arithmetic with numbers extending to 12 decimal places, such as 12.1234567891011 + 11.1234567891011, versus using shorter representations like 12.123 + 11.123, results in minimal speed differences on modern computers. While using floats may slightly reduce computation time due to handling fewer bytes, the actual performance gain is often negligible. This is because many systems automatically promote floats to doubles for calculations, which can negate any potential speed advantage. Additionally, if a computer cannot natively process 32-bit floats, it may convert them to doubles before performing calculations, potentially leading to slower performance for shorter numbers. Overall, on modern hardware, using double precision consistently yields no significant time difference in computations. Tools like awk have historically managed implicit datatype conversions effectively.
Tone L
Messages
72
Reaction score
7
If I am performing simple arithmetic on numbers that extend 12 decimal places i.g;
12.1234567891011 +11.1234567891011 and this calculation occurs 1000+ times, will calculation i.g;

12.123+11.123 speed up computation time if so how much and how do you arrive at this?
 
Computer science news on Phys.org
With modern computers the speed up would be very small to near zero. In your first example, the numbers can be represented by a double and in the second by a float. With a float you manipulating fewer bytes of data and hence it will run faster but only slightly.

In this stackoverflow article it mentions that it's machine dependent as to which runs faster as some machines promote floats to doubles and then do the math as doubles whereas others use a combination of software and hardware to allow the machine to do a double add using a float as the basic data type.

http://stackoverflow.com/questions/4584637/double-or-float-which-is-faster
 
  • Like
Likes Tone L
You have to consider that your computer may not know how to calculate in 32bit floats and may have to convert the float operands to double before calculation. The shorter numbers assuming they are float may calculate slower. If everything is double then there is no time difference on modern hardware.

BoB
 
  • Like
Likes jim mcnamara
Command line user programs like awk (a UNIX tool) have done this type of implicit datatype conversion ("under the covers") for many years.
 
Sorry if 'Profile Badge' is not the correct term. I have an MS 365 subscription and I've noticed on my Word documents the small circle with my initials in it is sometimes different in colour document to document (it's the circle at the top right of the doc, that, when you hover over it it tells you you're signed in; if you click on it you get a bit more info). Last night I had four docs with a red circle, one with blue. When I closed the blue and opened it again it was red. Today I have 3...
Thread 'ChatGPT Examples, Good and Bad'
I've been experimenting with ChatGPT. Some results are good, some very very bad. I think examples can help expose the properties of this AI. Maybe you can post some of your favorite examples and tell us what they reveal about the properties of this AI. (I had problems with copy/paste of text and formatting, so I'm posting my examples as screen shots. That is a promising start. :smile: But then I provided values V=1, R1=1, R2=2, R3=3 and asked for the value of I. At first, it said...
Back
Top