Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Bloody
Mar 3, 2013

if you want a float literal write it as 420.69f

Adbot
ADBOT LOVES YOU

BONGHITZ
Jan 1, 1970

whatever floats your boats

echinopsis
Apr 13, 2004

by Fluffdaddy


this is my spare time project for the next weeks

echinopsis
Apr 13, 2004

by Fluffdaddy
ive just noticed thats some weird compression on the stones from the iphones

Jonny 290
May 5, 2005



[ASK] me about OS/2 Warp
thread just got a lil weird

Doc Block
Apr 15, 2003
Fun Shoe
so they finally got "hospital" there in nz?

echinopsis
Apr 13, 2004

by Fluffdaddy
yeah but just the one though. and the fuckin queues are insane. legs been broken for weeks but finally got out of the rain and could see a doctor. at least i think he was a doctor, he had a white shirt on, which is pretty rare around these parts. must have been rich and smart i rekcon

Doc Block
Apr 15, 2003
Fun Shoe

echinopsis posted:

also can unity apply a torque as opposed to a directional force? i wonder if that might change the feel of it any?

so i tried this, and while it works, it's not that great. see for yourself

Doc Block fucked around with this message at 00:09 on Nov 22, 2014

theadder
Dec 30, 2011


echinopsis posted:



this is my spare time project for the next weeks

ohhhhh echi =/

peepsalot
Apr 24, 2007

        PEEP THIS...
           BITCH!

stay strong echo baby penis

echinopsis
Apr 13, 2004

by Fluffdaddy
baby? thats me

Sagebrush
Feb 26, 2012

echinopsis posted:

ive just noticed thats some weird compression on the stones from the iphones

i am really looking forward to the RAW capture in android 5

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

Doc Block posted:

why can't the compiler figure out that "69.69" should be a float when I'm assigning it as a float's value? not really a loss of precision issue there IMHO

it's one thing if I have a variable that's a double and try to pass it in a method argument declared as float, but no reason not to just turn a literal into whatever type it needs to be.

gently caress I hate super strongly typed languages, write everything in C and Objective-C forever.

It's because c# does whatever Java dors, and Java is a language made to keep idiots from hurting themselves, not to be productive

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

echinopsis posted:



this is my spare time project for the next weeks

R.I.P. oval office

echinopsis
Apr 13, 2004

by Fluffdaddy
lol if rip oval office isnt a popular surf clothing label in your country

Panty Saluter
Jan 17, 2004

Making learning fun!

echinopsis posted:



this is my spare time project for the next weeks

experimenting on disabled children??? what the gently caress man

echinopsis
Apr 13, 2004

by Fluffdaddy
someone has to do it

a cyberpunk goose
May 21, 2007

Doc Block posted:

just a directional force

also, C# is dumb as gently caress. like, if it expects a float you'd better give it one or else, because it won't cast anything to a float, even a literal.

so if you have a function that's like
code:
void Whatever(float yo)
and then try to call it with
code:
Whatever(33.5);
the compiler goes "NOPE, function wants a float but you're trying to pass a double, gently caress off". its the dumbest, most game programmer-iest thing in the world to have to put "f" after every single floating point literal. "I BETTER EXPLICITLY MARK EACH FLOATING POINT LITERAL AS A FLOAT, DON'T WANT ANY DOUBLES SNEAKING IN!!!!" And so you have to call the aforementioned function like "Whatever(33.5f)" instead of it just seeing that the function expects a float and turning the literal into one at compile-time.

you loving idiot be explicit with your constants always

a cyberpunk goose
May 21, 2007

compilers being clever is literally the worst thing you could ask for in a programming env

a cyberpunk goose
May 21, 2007

stupid idiot shitfuckers want a compiler to be a magic box that does everything they want it to and its "bad and dumb" if it does something they don't expect, like doing the right thing by not implicitly assuming a potentially lossy type like a lesser precision floating point. making your lang be strict when it's going to demote a datatype's width to something shittier is extremely valuable and you should be thanking C# for saving your dumb rear end

Sagebrush
Feb 26, 2012

i like strongly typed languages because they're all "gently caress you, this is how i, the computer, work, you need to actually understand that and i'm not going to hold your hand and make the best guess."

u learn much more about how computers work with data when you're given restrictions like that

a cyberpunk goose
May 21, 2007

jonny290 buy a Teensy 3.1, 96mhz of raw power with the convenience of arduino environment C, or you can just do raw C and use the on-board programmer, you just drag and drop your compiled friend onto your teensy 3.1 and off it goes.

a cyberpunk goose
May 21, 2007

i made a gift for a friend that streamed .wav files off an sd card while pushing the data to an i2c sound device while also driving a 96x64 oled rgb screen with animated sprites (it was bit banging SPI also because for w/e reason i couldnt get the display driver to play nice so it fell back to bit bangin, still there was enough speed and bandwidth to do all these intense peripheral actions)

you helped me build the little audio amp if you remember (i was sending in way too high a signal until i put a 64k pot on there and toned that poo poo way way way down)

Corla Plankun
May 8, 2007

improve the lives of everyone
i dont understand why it can't just be settable flag?

its super annoying when trying to use immediates in unity

Sagebrush
Feb 26, 2012

i once was explain to a student why the brightness of his led kept resetting to zero every few seconds when he was just ++; the brightness variable, and when what was happening on a register level clicked he suddenly had the biggest :2bong: mind-blown hollywood-hacking-movie-all-the-3d-puzzle-pieces-slot-into-place-ACCESS-GRANTED :2bong: grin

very gratifying

echinopsis
Apr 13, 2004

by Fluffdaddy

Doc Block posted:

so i tried this, and while it works, it's not that great. see for yourself

that owns you just need to modify friction

Luigi Thirty
Apr 30, 2006

Emergency confection port.

and that student later designed the therac 25

Doc Block
Apr 15, 2003
Fun Shoe
there is nothing clever or wrong with the compiler seeing that I typed a floating point number where a single-precision floating point number should go and saying, "Gawrsh, I'll bet he wants to pass that in as a float!" and then creating it as a float.

and if you type in a literal that's a whole number it'll automagically cast it to single-precision float at compile time, just not for floating point literals. "He typed 4? Sure, I can make that into a float at compile time, no prob. But 4.0? You can gently caress off with that poo poo, dude."

Doc Block fucked around with this message at 02:56 on Nov 22, 2014

Doc Block
Apr 15, 2003
Fun Shoe
it's not like I'm trying to pass a double variable in place of a float. any reasonable compiler should see a literal/immediate/whatever you want to call it getting passed as a float and do the right thing.

or do you think the compiler should throw an error if it sees
code:

float radius = 25.5;
?

or what about
C code:

short foo = 635;
? should it say "LOL No way m8, an integer literal is always an int, forever and ever, so get lost." and throw an error?

a cyberpunk goose
May 21, 2007

Doc Block posted:

it's not like I'm trying to pass a double variable in place of a float. any reasonable compiler should see a literal/immediate/whatever you want to call it getting passed as a float and do the right thing.

or do you think the compiler should throw an error if it sees
code:
float radius = 25.5;
?

or what about
C code:
short foo = 635;
? should it say "LOL No way m8, an integer literal is always an int, forever and ever, so get lost." and throw an error?

as a dude who learned what fuckers C compilers and linkers are yes

when im doing constants i just about always always always append a type qualifier like if i'm doing an unsigned long i'll do #define MY_SHIT_PISS_VARIABLE 88ul
its also really good form to put 'f' after any sort of thing you wanna be a float or 'D' for doubles

just do it, putting random numbers in a field and praying the compiler does the write thing is dumb and bad

a cyberpunk goose
May 21, 2007

Doc Block posted:

it's not like I'm trying to pass a double variable in place of a float. any reasonable compiler should see a literal/immediate/whatever you want to call it getting passed as a float and do the right thing.

or do you think the compiler should throw an error if it sees
code:
float radius = 25.5;
?

or what about
C code:
short foo = 635;
? should it say "LOL No way m8, an integer literal is always an int, forever and ever, so get lost." and throw an error?

yes to all this

a cyberpunk goose
May 21, 2007

if you think no its because you've never lost weeks and weeks of time to weird bugs that come from implicit casts

a cyberpunk goose
May 21, 2007

any opportunity you have to be very explicit about a constnat or a magic number you should take it

Doc Block
Apr 15, 2003
Fun Shoe
LOL that's loving ridiculous and insane. No, I am not going to type specific integer types for integer literals unless required because I'm typing a long or something. And I'm not going to do it for floating point numbers either without a damned good reason.

I regularly write code that has to work in both 32-bit and 64-bit environments. On both OS X and iOS, the commonly used types CGFloat, NSInteger, and NSUInteger are 32-bits in size in 32-bit environments but 64-bits long in 64-bit environments. The statement
Objective-C code:

CGFloat width = 127.5f;
still involves an implicit cast in 64-bit environments. There's no reason for it not to be
Objective-C code:

CGFloat width = 127.5;
and have the compiler do the right thing, given that it knows the type of width and so should be able to just insert a float for 32-bit code and a double for 64-bit.

Doc Block
Apr 15, 2003
Fun Shoe
And unless I was writing pure C, I would do const for magic numbers instead of #define's, to keep the kind of type safety that matters.

Luigi Thirty
Apr 30, 2006

Emergency confection port.

it's you, you are the programming disaster

a cyberpunk goose
May 21, 2007

Doc Block posted:

And unless I was writing pure C, I would do const for magic numbers instead of #define's, to keep the kind of type safety that matters.

you are entering the pain tunnel

there is no return

the world has no corner dark enough for people like you

a cyberpunk goose
May 21, 2007

I don't give a gently caress if you've had to tug your dick in the apple namespace

comment the intent of your lovely methods

keep it simple rear end in a top hat

avoid singletons in most cases

match the formatting of the agreed upon styling

name your loving variables classes and methods well and verbosely

take advantage of any features in the language that reduce ambiguities

and for gently caress sake qualify your magic constants

Doc Block
Apr 15, 2003
Fun Shoe
I do all of those things. My magic constants are better than yours because they contain actual type information:
Objective-C code:

// if I put an f on the end then this would still have an implicit cast in 64-bit code, since in 64-bit code CGFloat is typedef'ed to double
static const CGFloat foo = 420.69;

is 100 times better than
C code:

#define FOO 420.69f

Adbot
ADBOT LOVES YOU

Sagebrush
Feb 26, 2012

Doc Block posted:

I regularly write code that has to work in both 32-bit and 64-bit environments. On both OS X and iOS, the commonly used types CGFloat, NSInteger, and NSUInteger are 32-bits in size in 32-bit environments but 64-bits long in 64-bit environments. The statement

it's almost like there is a reason uint32_t and uint64_t and the others exist

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply