Skip to content

Comments

ДЗ № 12.2 Double под микроскопом, Шестаков Николай#17

Open
NicholayShestakov wants to merge 7 commits intomainfrom
double_under_microscope
Open

ДЗ № 12.2 Double под микроскопом, Шестаков Николай#17
NicholayShestakov wants to merge 7 commits intomainfrom
double_under_microscope

Conversation

@NicholayShestakov
Copy link
Owner

Add

  • Print double in exponential form

Copy link
Collaborator

@WoWaster WoWaster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Здесь вообще почти косметика


int main()
{
Number number;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Number number;
Number number = { .number = 0 };

int exponent = number.bitField.exp - 1023;
// Считаем мантиссу.
double mantissa = number.bitField.mantissa;
unsigned long two_in_52_pow = 1;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
unsigned long two_in_52_pow = 1;
unsigned long twoIn52Pow = 1;

double mantissa = number.bitField.mantissa;
unsigned long two_in_52_pow = 1;
two_in_52_pow = two_in_52_pow << 52;
double mantissaNormalized = 1 + mantissa / two_in_52_pow;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Хмм, такого я ещё не видел, но, наверное, оно работает.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants