Math.min / Math.max are varargs functions that return the smallest / largest value passed into them.
OP is a homosexual that knows thus but still chose to hide it.

it makes sense for Math.min() to return "infinitely high" if no value is passed. i.e. "there is no minimum" and vice versa

why not? why is it mental gymnastics?

Imagine you take the min of the result of Math.min and something else; you always want it to return that something else, so Math.min has to default to infinity.

it's exactly the same reason why an empty sum is 0 and an empty product is 1

Why do JavaShit apologists think that if there's a method to the madness, then it isn't madness?
Sure, obviously yes, there's a rational reason why Math.min() returns Infinity. That doesn't preclude it from being a fricking stupid reason.

>Why do JavaShit apologists think that if there's a method to the madness, then it isn't madness? >Sure, obviously yes, there's a rational reason why Math.min() returns Infinity. That doesn't preclude it from being a fricking stupid reason.
Return the minimum value between two values
Give it one input and it does the lowest of input vs infinity
Give it no inputs and the lowest value is infinity

1 month ago

Anonymous

>Give it no inputs and the lowest value is infinity
Mathematically, that is nonsense.
Calling a min/max function with no arguments is obviously an error on the part of the programmer, and so the compiler/interpreter should throw an error when this occurs.
And if not that, at the very least it should return something more sensible like null.

1 month ago

Anonymous

In programming languages, function overloading exists. This is a stupid mental gymnastics.

Honestly this. I use to be a le heckin "NaNNaNNaNNaN Batman!" Shitter too, but most of them make sense based on how they designed the type system. It's still dumb, but it makes perfect sense.

not him, it's moronic but I can understand the reasoning for most of it

1 month ago

Anonymous

The reasoning is that Brendan Eich had to shit out a proof-of-concept web programming language in a week and no one ever bothered to clean up his mistakes.

1 month ago

Anonymous

what should the output of Math.sum() be? What should the output of Math.all() be? What should the output of Math.product() be? Now, what should the output of Math.min() be?

4 weeks ago

Anonymous

>what should the output of Math.sum() be?
The "+"-wise sum of the given arguments. If no arguments are provided, an InvalidArgumentError is thrown. >What should the output of Math.all() be?
Same behavior as Array.every, where the predicate is the first argument. >What should the output of Math.product() be?
The "*"-wise sum of the given arguments. If no arguments are provided, an InvalidArgumentError is thrown. >Now, what should the output of Math.min() be?
The "<"-wise minimum of the given arguments. If no arguments are provided, an InvalidArgumentError is thrown.

4 weeks ago

Anonymous

>an InvalidArgumentError is thrown.
most annoying useless shit in the world.

Imagine you take the min of the result of Math.min and something else; you always want it to return that something else, so Math.min has to default to infinity.

not my problem

ok now write a function that generates a, b, and all the constants for any arbitrary pair of ("Fizz", "Buzz") integers (k1, k2) where k1 >=1, k2 >=1

*mogs*

whoops forgot image

Humiliation ritual.

Obj obj = new Obj();

var obj = new Obj();

Obj obj = new();

wtf...

I don't do javascript since I'm not a zoomer webshitter monkey but this actually makes sense. look up what an identity operator is.

identity element*

Infinity is the identity element of the min monoid.

-Infinity is the identity element of the max monoid.

Math.min / Math.max are varargs functions that return the smallest / largest value passed into them.

OP is a homosexual that knows thus but still chose to hide it.

RTFM Black person homosexual.

That's agreeing with what he said

Why do JavaShit apologists think that if there's a method to the madness, then it isn't madness?

Sure, obviously yes, there's a rational reason why Math.min() returns Infinity. That doesn't preclude it from being a fricking stupid reason.

>Why do JavaShit apologists think that if there's a method to the madness, then it isn't madness?

>Sure, obviously yes, there's a rational reason why Math.min() returns Infinity. That doesn't preclude it from being a fricking stupid reason.

Return the minimum value between two values

Give it one input and it does the lowest of input vs infinity

Give it no inputs and the lowest value is infinity

>Give it no inputs and the lowest value is infinity

Mathematically, that is nonsense.

Calling a min/max function with no arguments is obviously an error on the part of the programmer, and so the compiler/interpreter should throw an error when this occurs.

And if not that, at the very least it should return something more sensible like null.

In programming languages, function overloading exists. This is a stupid mental gymnastics.

>Why do

Why don't

If you don't understand the reason behind most of these then kys.

The floating point oddities are the only excusable ones. Everything else is moronic.

You simply don't understand js

You can understand something and also conclude that it is moronic.

Honestly this. I use to be a le heckin "NaNNaNNaNNaN Batman!" Shitter too, but most of them make sense based on how they designed the type system. It's still dumb, but it makes perfect sense.

>I admit it's shit, but please give me validation for the fact that I wasted my life swimming through the shit and understanding how it works

I will keep my sanity.

lost it at

>(!+[]+[]+![]).length

<9

Ever heard about toString() ?

>~~*Eich*~~

We call him the Eich man

these are all compile time errors in TypeScript, not my problem

JavaScript should have just been TypeScript from the start then.

The person who made this picture hasn't written a single line of code in C or C++

Honestly type coercion presented like this is managable. The horror is when you read plain js and those types of conversions happens all around.

makes sense

No.

not him, it's moronic but I can understand the reasoning for most of it

The reasoning is that Brendan Eich had to shit out a proof-of-concept web programming language in a week and no one ever bothered to clean up his mistakes.

what should the output of Math.sum() be? What should the output of Math.all() be? What should the output of Math.product() be? Now, what should the output of Math.min() be?

>what should the output of Math.sum() be?

The "+"-wise sum of the given arguments. If no arguments are provided, an InvalidArgumentError is thrown.

>What should the output of Math.all() be?

Same behavior as Array.every, where the predicate is the first argument.

>What should the output of Math.product() be?

The "*"-wise sum of the given arguments. If no arguments are provided, an InvalidArgumentError is thrown.

>Now, what should the output of Math.min() be?

The "<"-wise minimum of the given arguments. If no arguments are provided, an InvalidArgumentError is thrown.

>an InvalidArgumentError is thrown.

most annoying useless shit in the world.

>t. nocoder

Can someone explain these to me?

what the frick is 1 and 0 homie print true and false like a normal dude homie

>what the frick is 1 and 0

You don't know what numbers are?

Yes?

Disgusting trashlang.

Why does anybody even bother with the steaming pile of horseshit shitnile languages.

Anon is being a moron on purpose. fmax and fmin in C are functions, not constants. He was thus dereferencing the function pointers.

The troony compares functions

and the other troony, from the same discord server, jumps in to advertise his goods before roping when the shift is over.

this isn't really exclusive to javascript.

as a rule, if you take types and operators too seriously in programming, you're going to have a bad time.

it makes sense for Math.min() to return "infinitely high" if no value is passed. i.e. "there is no minimum" and vice versa

This mental gymnastics makes no sense.

it's exactly the same reason why an empty sum is 0 and an empty product is 1

sum and product is not constant, minimum number is.

why not? why is it mental gymnastics?

Imagine you take the min of the result of Math.min and something else; you always want it to return that something else, so Math.min has to default to infinity.

This is being implemented as follows is obvious:

function max(...values) {

let m = -Infinity;

values.forEach(v => {

if (v > m)

m = v;

});

}

But given that javascript numbers are always boxed, they could have picked null instead.

That's clearly an incorrect implementation.

right, forgot return m;

I'm a firm believer of JS being the worst mainstream programming language, but you're intentionally being a misleading homosexual, OP.

Correction: "*"-wise product.

git gud