Tags
 IOS SQL HTML C RUBY-ON-RAILS MYSQL ASP.NET DEVELOPMENT RUBY .NET LINUX SQL-SERVER REGEX WINDOWS ALGORITHM ECLIPSE VISUAL-STUDIO STRING SVN PERFORMANCE APACHE-FLEX UNIT-TESTING SECURITY LINQ UNIX MATH EMAIL OOP LANGUAGE-AGNOSTIC VB6

# C++ The correct way to multiply an integer and a double

By : llixiaoquan2
Date : July 29 2020, 05:00 PM
v * decimals is 11.9999999999... instead of 12 although when I print it using cout it shows 12
code :

Share :

## How to multiply integer by an IEEE double without conversion instructions?

By : Matthew Larson
Date : March 29 2020, 07:55 AM
wish of those help You can multiply a single or double precision float by 2^n just by adding n to the exponent, but for any other multiplier value you'll be changing the mantissa too, and that is obviously going to be non-trivial.

## Is it correct to compare the modulo of two double values with an integer in Java?

By : Anubhav
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further As mentioned in other answer, you should compare it with small value rather than an integer, the reason is:
Consider there two values: 1.0 and 0.1. If you do 1.0 % 0.1, it will give 0.09999999999999995, as the result of a rounding error. So here if you are comparing with Integer, it will return false.
code :
``````Math.abs(val1 % val2) < EPSILON //where EPSILON is a small value
``````

## How to multiply double (floating point) by an integer type (32-bit, 64-bit, 128-bit, etc.) manually

By : user3559909
Date : March 29 2020, 07:55 AM
With these it helps I am trying to manually implement multiplication between a double and a 128 bit integer that I have created myself using two ulongs. ,
what I am getting wrong here?
code :
``````1234567890123456
1361129467683753 853853498429727072.845824 - perceived product
1361129467683753 853853498429727072        - perceived rounded product
1361129467683753 792259819967610881        - product seen.
``````
``````1361129467683753 792259819967610880.0
``````

## What is the fastest way to multiply a 16-bit integer with a double?

By : user3733478
Date : March 29 2020, 07:55 AM
around this issue On an 8-bit micro controller I would like to do the following: , How about integer arithmetic in 32 bits?

## how to multiply integer or double with values in an array?

By : user3919718
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further In a simple way, i have an array of 10 values for example..and i would like to multiply each value with 5. Can i actually just do the following? , This is perfectly fine.