Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

1.0 vs 1

Name: Anonymous 2010-05-22 15:00

Does it really matter if something is a float or an integer? I mean COME ON!

Name: sager 2010-05-22 15:02

yes, shitty precision and slower performance for the same semantic.
also, OP is a faggot

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.

Name: sager 2010-05-22 15:04

>>3
>>1
Samefagging like a biatch

Name: Anonymous 2010-05-22 15:05

Fucking idiot. Why don't you go cast pointers to long doubles while you're at it?

Name: Anonymous 2010-05-22 15:05

>>4
>>2
also samefaggot

Name: Anonymous 2010-05-22 15:08

>>4,6
Back to /$imageboard/, please.

Name: Anonymous 2010-05-22 15:10

>>7
oh, no no no!

Name: Anonymous 2010-05-22 15:13

>>8
oh, yes yes yes!

Name: Anonymous 2010-05-22 15:18

>>1-9
DERP

Name: Anonymous 2010-05-22 15:22

y = y0 + (x - x0) * (y1 - y0) / (x1 - x0)

LERP

Name: Anonymous 2010-05-22 15:23

>>10
N0!

Name: tem !!yveogcjgZXaSkSV 2010-05-22 15:30

$

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.

Name: Anonymous 2010-05-22 15:53

>>14
You used the wrong spell.

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.

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.

Name: Anonymous 2010-05-22 15:59

>>17
I lol'd

Name: Anonymous 2010-05-22 15:59

>>14
casting only converts size, not the contents.
use “sprintf“.

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

Name: Anonymous 2010-05-22 18:21

>>20
Converting numeral types is one of the few exceptions.

Name: Anonymous 2010-05-22 18:38

>>21
All types are numeral types.

Name: Anonymous 2010-05-22 22:58

I can't say who is trolling anymore!

Name: Anonymous 2010-05-22 23:55

In C, 1.0 has type double, not float.

The More You Know
≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡★

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.

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
≡≡≡≡≡≡≡≡≡≡≡≡≡≡★

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.

Name: Anonymous 2010-05-23 0:10

>>27
fails on icc

Name: Anonymous 2010-05-23 0:12

>>28
Make sure you are compiling as C.

Name: Anonymous 2010-05-23 3:39

for (float f = 0.0; f != 10000000000.0; f += 1) printf("%f", f)

Do it, ``faggot''

Name: Anonymous 2010-05-23 3:40

f != 10000000000.0;
Gee.

Name: Anonymous 2010-12-06 9:56

Back to /b/, ``GNAA Faggot''

Don't change these.
Name: Email:
Entire Thread Thread List