I am working on a functions HW for my programming class and Im trying to write a function that will allow me to do exponent math (in a simple form). (Oh and I can't use the actual exponent function, I have to write my own function using for loops, if...

This question already has an answer here: How to get the sign, mantissa and exponent of a floating point number 5 answers so I got a task where I have to extract the sign, exponent and mantissa from a floating point number given as uint32_t. I have to do...

Here's an illustration of what I'm asking about: I'm just curious about how Ruby is interpreting these problems, which are clearly different as far as Ruby is concerned. I became curious when I was trying to write a simple math problem without using floats and noted that Ruby would read...

I want to calculate with numbers having 3 places before and 2 places after decimal point (of course, 2 and 3 are configurable). I think it will be easiest to explain by examples: 0.01 and 999.99 are the lower and upper limit for positive numbers. Of course, there is also...

This question already has an answer here: Why Are Floating Point Numbers Inaccurate? 3 answers While programming I noticed a difference between the result of math.exp(2) and math.e**2. As you can see below, this difference does not arise when calculating e^1. Not being an experienced programmer, I wondered why...

I am working on a cryptography implementation and part of the design includes the following: ( (y^a)^b / (y^c)^b ) mod p I have the following snippet: BigInteger yab = y.pow(ab.intValue()); BigInteger ycb = y.pow(cb.intValue()); BigInteger ans = (yab.divide(ycb)).mod(p); It works fine for small integer. Once I replaced it with...