1.0 vs 1
1
Name:
Anonymous
2010-05-22 15:00
Does it really matter if something is a float or an integer? I mean COME ON!
2
Name:
sager
2010-05-22 15:02
yes, shitty precision and slower performance for the same semantic.
also, OP is a faggot
3
Name:
Anonymous
2010-05-22 15:04
>>1
yes it does bitch!
the processor uses a completly different part to compute float, and besides, floats have a limited precision.
4
Name:
sager
2010-05-22 15:04
>>3
>>1
Samefagging like a biatch
5
Name:
Anonymous
2010-05-22 15:05
Fucking idiot. Why don't you go cast pointers to long doubles while you're at it?
6
Name:
Anonymous
2010-05-22 15:05
7
Name:
Anonymous
2010-05-22 15:08
>>4,6
Back to /$imageboard/, please.
8
Name:
Anonymous
2010-05-22 15:10
9
Name:
Anonymous
2010-05-22 15:13
10
Name:
Anonymous
2010-05-22 15:18
11
Name:
Anonymous
2010-05-22 15:22
y = y0 + (x - x0 ) * (y1 - y0 ) / (x1 - x0 )
LERP
12
Name:
Anonymous
2010-05-22 15:23
13
Name:
tem
!!yveogcjgZXaSkSV
2010-05-22 15:30
$
14
Name:
Anonymous
2010-05-22 15:52
How do I turn a float into a string? I tried char *text = (char *)float, but it doen't cast properly.
15
Name:
Anonymous
2010-05-22 15:53
>>14
You used the wrong
spell.
16
Name:
Anonymous
2010-05-22 15:54
>>14
sprintf
What you did is quite wrong, C isn't SEPPLES or other high-level languages, when you cast something like that you'll just treat a piece of data as another type instead of actually convert it - doing that without proper understanding will only lead to wrong results.
17
Name:
Anonymous
2010-05-22 15:56
>>16
okay. what about when I want to cast an integer? there doent seem to be a sprinti method.
18
Name:
Anonymous
2010-05-22 15:59
19
Name:
Anonymous
2010-05-22 15:59
>>14
casting only converts size, not the contents.
use “sprintf“.
20
Name:
Anonymous
2010-05-22 16:39
>>19
casting only converts size, not the contents.
lol@dongs$ cat > c.c
#include <stdio.h>
int main(void)
{
float a = 1.0;
printf("%d\n", (int)a);
return 0;
}
^D
lol@dongs$ gcc c.c && ./a.out
1
21
Name:
Anonymous
2010-05-22 18:21
>>20
Converting numeral types is one of the few exceptions.
22
Name:
Anonymous
2010-05-22 18:38
>>21
All types are numeral types.
23
Name:
Anonymous
2010-05-22 22:58
I can't say who is trolling anymore!
24
Name:
Anonymous
2010-05-22 23:55
In C, 1.0 has type double, not float.
The More You Know
≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡★
25
Name:
Anonymous
2010-05-22 23:57
>>24
In C,
float a = 1.0; will leave you with a float stored in
a. You can write
1.0f instead, but it's unnecessary. Even
-Wall -Wextra -pedantic doesn't complain about it.
26
Name:
Anonymous
2010-05-23 0:02
>>25
Correct! In C, the simple assignment operator (
=) converts the type of its right operand to the type its left operand.
The More You Know
≡≡≡≡≡≡≡≡≡≡≡≡≡≡★
27
Name:
Anonymous
2010-05-23 0:04
>>25
of course it doesn't complain. it doesn't complain if you do
double a = 1.0; float b = a;, either.
28
Name:
Anonymous
2010-05-23 0:10
29
Name:
Anonymous
2010-05-23 0:12
>>28
Make sure you are compiling as C.
30
Name:
Anonymous
2010-05-23 3:39
for (float f = 0.0; f != 10000000000.0; f += 1) printf("%f", f)
Do it, ``faggot''
31
Name:
Anonymous
2010-05-23 3:40
f != 10000000000.0;
Gee.
33
Name:
Anonymous
2010-12-06 9:56
B a c k t o / b / , ` ` G N A A F a g g o t ' '