ClickHouse/base/base/shift10.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

17 lines
385 B
C++
Raw Normal View History

2018-01-13 18:01:31 +00:00
#pragma once
2021-10-02 07:13:14 +00:00
#include <base/types.h>
2018-01-13 18:01:31 +00:00
/** Almost the same as x = x * exp10(exponent), but gives more accurate result.
* Example:
* 5 * 1e-11 = 4.9999999999999995e-11
* !=
* 5e-11 = shift10(5.0, -11)
*/
double shift10(double x, int exponent);
float shift10(float x, int exponent);
2022-09-10 02:07:51 +00:00
long double shift10(UInt64 x, int exponent);
long double shift10(Int64 x, int exponent);