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
6
votes
2 answers

Define F# '**' operator in C#

I see that F# uses the ** operator for powers, so 2 ** 5 = 32. This is different from C#, where you have the option to use the '^' operator in your custom types, but for some reason isn't used by the built in number types. But how do you implement…
6
votes
1 answer

Is Math.pow more expensive than multiplication using temporary assignments?

When porting a javascript library to Python, I found this code: return Math.atan2( Math.sqrt( (_ = cosφ1 * sinΔλ) * _ + (_ = cosφ0 * sinφ1 - sinφ0 * cosφ1 * cosΔλ) * _ ), sinφ0 * sinφ1 + cosφ0 * cosφ1 * cosΔλ ); Am I wrong or (_…
Paulo Scardine
  • 73,447
  • 11
  • 124
  • 153
6
votes
8 answers

Large Exponents in Ruby?

I'm just doing some University related Diffie-Hellman exercises and tried to use ruby for it. Sadly, ruby doesn't seem to be able to deal with large exponents: warning: in a**b, b may be too big NaN [...] Is there any way around it? (e.g. a…
Marc Seeger
  • 2,717
  • 4
  • 28
  • 32
6
votes
3 answers

convert exponential to decimal in python

I have an array in python that contains a set of values, some of them are 2.32313e+07 2.1155e+07 1.923e+07 11856 112.32 How do I convert the exponential formats to the decimal format Additional: Is there a way I can convert the exponent directly to…
randomThought
  • 6,203
  • 15
  • 56
  • 72
6
votes
3 answers

Php, calculating exponent with caret (^) fails

Wolfram Alpha says will give the correct result for the following formula: ((0.0004954*($current^2))-((0.935*$current)+378.486))- ((0.0004954*($desired^2))-((0.935*$desired)+378.486)); But when I run it in PHP, it does not give the correct answer,…
Jerry Xiong
  • 69
  • 1
  • 2
5
votes
2 answers

Why does the multiplicative inverse of 0 result in infinity?

I am writing a program in Swift that takes the multiplicative inverse of random bytes. Sometimes, the byte is 0, and when the multiplicative inverse is taken, it results in inf. The multiplicative inverse is being determined using powf(Float(byte),…
Todd
  • 500
  • 4
  • 10
5
votes
4 answers

Converting unit abbreviations to numbers

I have a dataset that abbreviates numerical values in a column. For example, 12M mean 12 million, 1.2k means 1,200. M and k are the only abbreviations. How can I write code that allows R to sort these values from lowest to highest? I've though…
5
votes
5 answers

Fast method of calculating square root and power?

C#'s Math class does roots and powers in double only. Various things may go a bit faster if I add float-based square-root and power functions to my Math2 class (Today is a relaxation day and I find optimization relaxing). So - Fast square-root and…
Narf the Mouse
  • 1,541
  • 5
  • 18
  • 30
5
votes
2 answers

Is there a specification for a floating point’s exponent bias?

IEEE floating point exponents are stored as unsigned integers, using a pre-defined exponent bias to offset the exponent. The exponent bias seems to be consistently equal to numeric_limits::max_exponent - 1 where T is the floating point type. I do…
Jonathan Mee
  • 37,899
  • 23
  • 129
  • 288
5
votes
1 answer

Facebook Login using Exponent React Native

Need help guys, currently using exponent and accessing the Exponent.Facebook.logInWithReadPermissionsAsync for authentication. Anyone has a guide in setting up the project. I can't find the iOS folder since in the instruction of facebook sdk, I need…
Ruie Pena
  • 63
  • 1
  • 5
5
votes
2 answers

What kind of data are exponent and modulus in c# RSACryptoServiceProvider?

I have the public key generated in c# with RSACryptoServiceProvider: 4kKhD/FWAMtQTRifArfXjxZN+6bOXTkHrVpyz/1wODhSOBqDewoSOFAp5boBd3wFjXszHA+gpUxZNWHRTj898Q== AQAB …
5
votes
2 answers

GLSL: pow vs multiplication for integer exponent

Which is faster in GLSL: pow(x, 3.0f); or x*x*x; ? Does exponentiation performance depend on hardware vendor or exponent value?
Sergey
  • 7,985
  • 4
  • 48
  • 80
5
votes
2 answers

Why np.array([1e5])**2 is different from np.array([100000])**2 in Python?

May someone please explain me why np.array([1e5])**2 is not the equivalent of np.array([100000])**2? Coming from Matlab, I found it confusing! >>> np.array([1e5])**2 array([ 1.00000000e+10]) # correct >>>…
Amin
  • 437
  • 2
  • 4
  • 17
5
votes
3 answers

Why does exponential notation with decimal values fail?

Conventionally 1e3 means 10**3. >>> 1e3 1000.0 >>> 10**3 1000 Similar case is exp(3) compared to e**3. >>> exp(3) 20.085536923187668 >>> e**3 20.085536923187664 However now notice if the exponent is a float value: >>>…
Developer
  • 8,258
  • 8
  • 49
  • 58
5
votes
7 answers

Recursive Exponent Method

public static int exponent(int baseNum) { int temp = baseNum *= baseNum; return temp * exponent(baseNum); } Right now the method above does n * n into infinity if I debug it, so it still works but I need…
Matt Andrzejczuk
  • 2,001
  • 9
  • 36
  • 51