What are the Values of Machine Constants in Excel/VBA?

In summary, the Fortran code for TOMS Algorithm 691 refers to two machine constants, "the smallest relative spacing" and "the largest relative spacing", which are used for fine-grain error management. These constants are defined in terms of standard C library functions, with the smallest relative spacing being the smallest number x such that 1.0 + x != 1.0. In the Excel/VBA environment, the value for the smallest relative spacing is around 4.996E-15, but there is no information available on the value for the largest relative spacing.
  • #1
kubota
4
0
What are the Values of "Machine Constants" in Excel/VBA?

The Fortran code for TOMS Algorithm 691 refers to five "machine constants" belonging to the host computing environment. Two of these are:

1. "The smallest relative spacing", given as "B ** (-T)", where B = base (say 10?), and T = number of base-B digits, say 15, so this = 10**-15...?
2. "The largest relative spacing", given as "B**(1-T)", so this = 10**(1-15) = 10**-14...?

It appears the values are being used in the program for fine-grain error management. Unfortunately, I can find no general references to these constants, and I'm not certain what they mean, nor what their values are...

Would anyone be able to enlighten me on the particular values of these two parameters for the Excel/VBA environment.

TIA for any assistance.
 
Technology news on Phys.org
  • #2


See http://www.netlib.org/blas/d1mach.f

At the bottom of the code these constants are defined in terms of standard C library functions, so you can get more details from the C standard if you need that.
 
  • #3


Thanks for your reply.

I found one glimmer of hope in a statement in a (web) file named C Standard Library <float.h>:

... EPSILON: smallest number x such that 1.0 + x != 1.0

Using Excel, I obtained a figure of around 4.996E-15, which may well be the value for my point 1 above, ie, the smallest relative spacing. Am I on the right track here?

Unfortunately, I can find no similar example or statement defining my point 2 above.

Any help appreciated.
 

Related to What are the Values of Machine Constants in Excel/VBA?

What are machine constants in Excel/VBA?

Machine constants in Excel/VBA are pre-defined numerical values that are used in mathematical calculations. They are designed to provide a high level of accuracy and consistency in calculations across different computer systems.

How are machine constants different from regular constants?

Regular constants are user-defined values that are entered manually into a program, while machine constants are pre-defined values that are built into the programming language. This means that machine constants are standardized and consistent across different computer systems, while regular constants can vary depending on the user's input.

What are the most commonly used machine constants in Excel/VBA?

The most commonly used machine constants in Excel/VBA are Pi (π), which represents the ratio of a circle's circumference to its diameter, and the Euler's number (e), which is used in exponential and logarithmic functions.

How can I use machine constants in my Excel/VBA code?

To use machine constants in your Excel/VBA code, you can simply type in the name of the constant (e.g. "Pi") instead of manually entering its value. The program will automatically recognize and use the pre-defined value of the constant in your calculations.

Can I create my own machine constants in Excel/VBA?

No, machine constants are built-in and cannot be created or modified by the user. However, you can create your own regular constants in Excel/VBA if needed.

Similar threads

  • Programming and Computer Science
Replies
17
Views
1K
Replies
2
Views
1K
  • Programming and Computer Science
Replies
29
Views
3K
  • Programming and Computer Science
Replies
18
Views
5K
  • Other Physics Topics
Replies
1
Views
3K
  • Programming and Computer Science
Replies
1
Views
1K
  • Introductory Physics Homework Help
Replies
30
Views
2K
Replies
2
Views
921
Replies
18
Views
1K
Replies
131
Views
4K
Back
Top