Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Annibale <vannnnia1991@gmail.com> |
|---|---|
| Newsgroups | it.comp.java |
| Subject | Re: che arrotondamento fa? |
| Date | 2019-10-08 21:05 +0200 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <qniml1$1rkh$1@gioia.aioe.org> (permalink) |
| References | <qna435$kom$1@gioia.aioe.org> <qnade7$coh$1@dont-email.me> |
Il 05/10/2019 17:38, 4ndre4 ha scritto:
> On 05/10/2019 13:59, Annibale wrote:
>> float x = (float) 23123.456;
>>
>> ottengo:
>> x=23123.455
>>
>> ma usa sempre i millesimi!
>> Perchè allora non scrive 23123.456 ?
>>
>> Se arrotonda dovrebbe stampare solo fino ai centesimi :
>> 23123.45
>
> https://www.linkedin.com/pulse/why-isnt-11-22-33-andrea-laforgia/
>
>
sapresti tradurre in java questo codice?
Vorrei fare delle prove.
Grazie
#include <stdio.h>
#include <stdlib.h>
void print_double_bytes(double d) {
unsigned char *p = (unsigned char*)&d;
for (size_t i=0; i<sizeof d; i++) {
printf("%.2x", p[i]);
}
printf("\n");
}
int main() {
double a = 1.1;
double b = 2.2;
double c = 3.3;
print_double_bytes(a);
print_double_bytes(b);
print_double_bytes(a+b);
print_double_bytes(c);
return 0;
}
Back to it.comp.java | Previous | Next — Previous in thread | Next in thread | Find similar
che arrotondamento fa? Annibale <vannnnia1991@gmail.com> - 2019-10-05 14:59 +0200
Re: che arrotondamento fa? 4ndre4 <4ndre4@4ndre4.invalid> - 2019-10-05 16:38 +0100
Re: che arrotondamento fa? Annibale <vannnnia1991@gmail.com> - 2019-10-08 21:05 +0200
Re: che arrotondamento fa? "Dr.UgoGagliardelli" <do.not.spam@me.please> - 2019-10-09 07:45 +0200
Re: che arrotondamento fa? Annibale <vannnnia1991@gmail.com> - 2019-10-10 01:15 +0200
Re: che arrotondamento fa? "Dr.UgoGagliardelli" <do.not.spam@me.please> - 2019-10-06 10:21 +0200
csiph-web