Significant digit computation time

  • Thread starter Thread starter Tone L
  • Start date Start date
  • Tags Tags
    Computation Time
Click For Summary

Discussion Overview

The discussion revolves around the impact of significant digits on computation time in arithmetic operations, particularly comparing the use of numbers with 12 decimal places versus shorter representations. The scope includes technical considerations of data types (float vs. double) and their implications for performance in computational tasks.

Discussion Character

  • Technical explanation, Debate/contested

Main Points Raised

  • One participant questions whether using shorter representations of numbers (e.g., 12.123 instead of 12.1234567891011) would speed up computation time, particularly when performed multiple times.
  • Another participant suggests that with modern computers, the speedup from using shorter numbers would be minimal to negligible, noting that the choice between float and double data types affects performance.
  • A different viewpoint highlights that some computers may need to convert float operands to double before performing calculations, which could negate any potential speed advantage of using shorter numbers.
  • One participant mentions that command line tools like awk have historically managed implicit datatype conversions, indicating that such conversions are not new to computing.

Areas of Agreement / Disagreement

Participants express differing views on the impact of data types and number representation on computation speed, indicating that the discussion remains unresolved regarding the extent of performance differences.

Contextual Notes

The discussion does not clarify specific conditions under which the performance differences might be observed, nor does it resolve the dependency on machine architecture and implementation details.

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   Reactions: 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   Reactions: 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.
 

Similar threads

  • · Replies 8 ·
Replies
8
Views
2K
Replies
8
Views
4K
Replies
4
Views
2K
  • · Replies 29 ·
Replies
29
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
5K
  • · Replies 11 ·
Replies
11
Views
2K
Replies
4
Views
2K
  • · Replies 40 ·
2
Replies
40
Views
5K