Questions tagged [exponent]

Exponentiation is a mathematical operation, written as b raised to the power of n, involving two numbers, the base b and the exponent (or power) n.

Exponentiation refers to the mathematical operation involving two numbers, one is a base and another is an exponent. It is repeated multiplication. To calculate 53 you have to multiply the number 5 (base) by itself 3 times (exponent).

588 questions
8
votes
2 answers

How do I get a floating point number as a string without the exponent notation?

How do I get a floating point number as a string without the exponent notation, that is, a number that ends in "e-10" or similar? I discovered to_s returns the number with the exponent notation. ms = 1457000.0000000002 % 1000 # =>…
user7055375
8
votes
2 answers

How to do exponentiation in constant expression?

Having used the exponent operator ^ in the initialisation of a VB class's public constant following this question. Public Const MaxValue As Double = MaxMantissa * (2 ^ MaxExponent) I am converting the class to C#. however I find that C# does not…
Toby
  • 9,696
  • 16
  • 68
  • 132
8
votes
6 answers

Calculating powers (e.g. 2^11) quickly

Possible Duplicate: The most efficient way to implement an integer based power function pow(int, int) How can I calculate powers with better runtime? E.g. 2^13. I remember seeing somewhere that it has something to do with the following…
Meir
  • 12,285
  • 19
  • 58
  • 70
7
votes
3 answers

Square Root in MongoDB Aggregate Pipeline

Is there a way to get the square root of a field in the MongoDB aggregate pipeline? I'm think of something like this: db.collection.aggregate( { $group: _id: null, sum: { $sum: "$values" }}, { $project: { answer: { $sqrt: "$sum" }}}) I know…
dstreit
  • 716
  • 1
  • 7
  • 8
7
votes
4 answers

what is difference between (**) and (<<) in python?

a = 100000000 c = (2**(a-1))-1 b = (2<<(a-1))-1 m = 1000000007 print b%m print c%m Output : 494499947 247249973 I am using ** and << operator in python to find powers of 2 raised to a very large number . However similar operations give different…
Harshit
  • 1,207
  • 1
  • 20
  • 40
7
votes
2 answers

How to calculate an arbitrary power/root?

I have a application which needs to raise a number to a fractional power. The target platform is an FPGA and I can get estimates on an FPU size for it, but I need an algorithm for raising a number to a fractional power just for a feasibility study.…
NoMoreZealots
  • 5,274
  • 7
  • 39
  • 56
7
votes
2 answers

How to get Exponent of Scientific Notation in Matlab

When the numbers are really small, Matlab automatically shows them formatted in Scientific Notation. Example: A = rand(3) / 10000000000000000; A = 1.0e-016 * 0.6340 0.1077 0.6477 0.3012 0.7984 0.0551 0.5830 0.8751 …
Rachel
  • 1,722
  • 8
  • 29
  • 34
6
votes
4 answers

limit the exponential notation decimal place to 4 in javascript

How to limit the decimal place to 4 in javascript with this type of values? the e is the exponent since I am using power of ten values. toFixed() doesn't seem to work. 1.0531436913408342e-7 -5.265718456704172e-7 8.425149530726674e7
philip
  • 1,292
  • 3
  • 24
  • 44
6
votes
1 answer

Difference between Exponent operator ^ and Math.pow()

What is the difference between: 100 ^ 49; // = 85 and Math.pow(100, 49); // = 1e+98 JavaScript returns different results and I don't know why.
Ctor
  • 89
  • 1
  • 5
6
votes
3 answers

In Matlab, how to specify number of digits in the exponent using formatSpec formatting operator?

I'm writing data to an output text file using the fprintf command in Matlab. How to write a number to the output file, for instance, 1.12345678e-001, with three digits in the exponent? formatSpec = '%1.8e\n'; gives 1.12345678e-01, not the desired…
Emma
  • 149
  • 10
6
votes
5 answers

Python math range error

I'm getting an error when trying to calculate a very large number in Python. Here is my code: # Where fourthNumber = 2790 # and dee = 413 emm = math.pow(fourthNumber, dee) An my error is: line 44, in emm = math.pow(fourthNumber,…
Coder117
  • 801
  • 2
  • 9
  • 22
6
votes
1 answer

Double value to scientific notation with fixed exponent C#

I am having value double value = 1427799000; I would like to convert it to scientific notation where the values exponent must always 10^11 (E+11). I have tried following but it is not working. Console.WriteLine(value.ToString("00.##E+11",…
John
  • 351
  • 4
  • 16
6
votes
2 answers

exponent digits in scientific notation in Python

In Python, scientific notation always gives me 2 digits in exponent: print('%17.8E\n' % 0.0665745511651039) 6.65745512E-02 However, I badly want to have 3 digits like: 6.65745512E-002 Can we do this with a built-in configuration/function in…
IanHacker
  • 541
  • 9
  • 27
6
votes
3 answers

java.math.BigInteger pow(exponent) question

I did some tests on pow(exponent) method. Unfortunately, my math skills are not strong enough to handle the following problem. I'm using this code: BigInteger.valueOf(2).pow(var); Results: var | time in ms 2000000 | 11450 2500000 | 12471 3000000…
Jan Kraus
  • 63
  • 1
  • 3
6
votes
12 answers

how to get exponents without using the math.pow for java

This is my program // ************************************************************ // PowersOf2.java // // Print out as many powers of 2 as the user requests // // ************************************************************ …
user3552056
  • 61
  • 1
  • 1
  • 2
1 2
3
39 40