[OT] Simple arithmetic

Jan 26, 2017 60 Replies
Saved reading

LOL. My wife's just started learning PHP and it's very flexible about data types. I'm used to languages such as Pascal and C where types must match, either enforced by the compiler (Pascal) or else forced by casting (C). It's a bit unsettling to see her doing a string input from the user and then testing whether it's greater than 3 as if the operator was an integer. I'd be casting or calling a conversion function to make really really sure!

PHP is, like BASIC, a language that you can use very quickly to get tangible and useful results.

Writing GOOD code in it is more tricky.

As an Engineer, I like C . There are rules, but you can explicitly break them.

int i; float f; i=3; f=(float)i;

is a classic case.

An *explicit* conversion is made... One recols in hoorow at

$i='3'; $i++;

2.07 ft seems better. You can easily check against major error by carefully drawing a diagram, scale 1 cm to 1 ft, on a piece of paper.

Surely you have a drawing prog on your computer to do this more easily?

Something like a free 2D CAD prog would make it easy to check the dimensions too.

you are the f****it for not realising the ambiguity of the missing operator BODMAS or PEMDAS 6/2x(1+2) or 6/[2(1+2)]

-

Nope. You're still a retard. There is no ambiguity, just 'tards like you who don't understand the rules and keep reposting these dumbfuck memes all over the place.

You're still a retard. There is Huge (sic!) ambiguity.

you are guessing at what the person that wrote 6/2(1+2) meant if you put that as written into a calculator you are just as likely to get an answer of 1 as you are of 9 first ?Rule? of mathematics is dont make assumptions.

-

I thought it was make it understandable.

Well said - and follow the syntax of the package/program that is being used.

And use brackets to enforce precedence if there is any doubt.

It's obvious! :-)

It's 6, divided by the result of the call of a function named '2', which takes an argument of '1+2'.

Pythagoras would have not completely agreed with all that you wrote.

What would he have said then?

The squaw of the hippopotamus is equal to the sons of the squaws of the other two hides ...?

Is that Frank Norden - or Denis Muir?

Cost he was an argumentative old git, and predates decimal numbers anyway.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required