Java loss of precision

前端 未结 3 409
盖世英雄少女心
盖世英雄少女心 2020-12-12 05:04

I have a problem concerned with losing of precision

my task is to print numbers as strings

int exponent = ...
int[] Mantissas = { 1, 2, 5 };
double          


        
3条回答
  •  隐瞒了意图╮
    2020-12-12 05:36

    Search for "floating point numbers" on SO and you'll get a slew of answers as to why this happens. It has to do with how floating point numbers are represented in computers.

    How is floating point stored? When does it matter?

    Another article on the matter - Floating Point Approximation

提交回复
热议问题