Fork me on GitHub
#off-topic
<
2024-04-03
>
Joseph Graham11:04:25

Java has some interesting maths:

user> (= Double/POSITIVE_INFINITY (- Double/POSITIVE_INFINITY 5))
true

p-himik11:04:13

I think it's quite expected. :)

☝️ 7
Joseph Graham11:04:10

It breaks the laws of algebra

Joseph Graham11:04:41

If we cancel out the infinity on both sides of the equation we end up with 5 = 0

p-himik11:04:46

What are "laws of algebra", exactly?

Sam Ferrell11:04:02

infinity is not a number

Joseph Graham11:04:07

Dunno I'm not a mathematician

🙌 1
Sam Ferrell11:04:11

its a symbol and arithmetic on it is not defined

Sam Ferrell11:04:57

Number.POSITIVE_INFINITY - Number.POSITIVE_INFINITY is NaN I think this is defined by https://en.wikipedia.org/wiki/IEEE_754-1985

Joseph Graham11:04:23

Wow that's cool

Joseph Graham11:04:19

I dont agree with infinity being equal to infinity though

Joseph Graham11:04:23

Breaks all reasonable assumptions about how arithmetic works

p-himik11:04:21

Infinity is not a part of arithmetic. Just as division by zero is not legal in arithmetic. So you can't do 1 * 0 = 2 * 0 => 1 = 2.

Joseph Graham11:04:01

Java does allow addition, subtraction, multiplication and division on infinity

p-himik11:04:18

Just because something doesn't correspond to your current assumptions doesn't mean that that something should be changed or that those assumptions are correct.

Joseph Graham11:04:50

I guess I just have to add a special case for infinity to protect against the chaos it causes.

p-himik11:04:54

Depends on the scenario. Also don't forget about the negative infinity and NaN.

Sam Ferrell11:04:20

infinity in programming is pretty useful to generalize some things, like a function that accepts a lower and upper range can be expanded to everything by passing it negative and positive infinity

👍 1
Sam Ferrell12:04:04

as opposed to something more hacky like (-999, 999) or min and max integers

👍 1
Sam Ferrell12:04:38

or giving a node in a graph a weight of positive infinity simplifies dijkstra's to represent something impassable

Joseph Graham12:04:22

hm right I see

Joseph Graham12:04:10

I guess it can be useful but its infinity = infininty I have a problem with.

Joseph Graham12:04:57

I dont think its true and it break algebra

p-himik12:04:35

How can you say "it breaks X" when you can't define "X"?

Joseph Graham12:04:29

Algebra gives you certain rules about how you can manipulate numbers regardless of their values

borkdude12:04:35

Infinity + 5 is still infinity, you can't cancel out infinity by adding a finite number

p-himik12:04:19

> Algebra gives you certain rules how you can manipulate numbers An infinity is not a number.

Joseph Graham12:04:31

I agree but Java dont

p-himik12:04:52

Number is not a number, in the arithmetic sense. :)

p-himik12:04:01

And it's not Java, it's that IEEE.

Sam Ferrell12:04:34

whatever particular behavior infinity exhibits in java doesn't necessarily reflect more rigorous mathematical definitions in its various contexts

Sam Ferrell12:04:54

java is just being practical

👍 1
oyakushev14:04:22

> I dont agree with infinity being equal to infinity though Sounds like you miss some pretty basic education, tbh.

oyakushev14:04:24

Furthermore, you should pretty much never compare floating-point numbers by equality, it's a bad idea not only because of this infinity case.

oyakushev14:04:58

If you want to deal only with integer values, then it makes sense to enforce it. Otherwise, it is better to compare the absolute difference between two numbers to some epsilon, and also handle infinities and NaN explicitly.

selahb15:04:38

Wouldn't call it "basic". Infinity is a deep and fascinating concept that continues to surprise even the most accomplished mathematicians. And now you're in on the fun @U043HLWSYUQ!

Joseph Graham15:04:04

Yeah theres countable infinity and uncountable isnt there. I guess since it's a float it's uncountable.

selahb15:04:49

Real numbers are uncountable, but that's assuming infinite precision and scale. When realized on computers, floats are represented by finite bytes, so you can indeed count them. (And they're not infinite.)

oyakushev15:04:59

Here's another one that can break assumptions if you are not careful.

user=> (= (* (/ Double/MIN_VALUE 2) 2) Double/MIN_VALUE)
false
user=> (= Double/MAX_VALUE (+ Double/MAX_VALUE 1))
true

genmeblog17:04:17

There is an extended real numbers concept in math, where infinities are included and operations are defined. It's nothing wrong to treat the infinity as an entity and define operations on it. https://en.m.wikipedia.org/wiki/Extended_real_number_line

genmeblog18:04:15

Another example: In complex numbers you can have an infinity (which is not related to real infinities) and 1/0 is defined and equals infinity also 1/inf is 0. So everything depends on context.

Daniel Craig16:04:57

What’s a polite way to ask someone if they are using AI? A coworker is producing documentation that has factual errors, that is unfocused and loquacious, and which makes my mind feel like I’m asleep and I’m dreaming about reading.

Daniel Craig16:04:20

To me it has all the fuzzy characteristics of AI, but I don’t want to accuse someone

souenzzo16:04:28

I think that don't matter which tool he is using. I would focus my criticism on the existing problems in the documentation

1
Daniel Craig16:04:46

AI can invent false facts faster than I can proofread

p-himik16:04:57

"Hey, did you use any AI service when writing this?"

p-himik16:04:23

Just in case you decide to go with the opposite: "Damn, even AI would've done a better job." :)

1
😂 1
isak17:04:37

Addressing a coworker about the quality of their work, especially when suspecting the use of AI, can be a sensitive topic. It's crucial to approach the conversation with tact, focusing on the work's impact rather than the method of its creation. Here’s a suggestion on how to approach the topic politely and constructively: 1. Start with a Positive Note or a Common Goal: Begin the conversation by mentioning something positive about their work or reiterating a common goal you both share, like improving team documentation or ensuring clarity and accuracy in shared projects. ◦ “I’ve noticed the effort you’ve put into our recent documentation, and I appreciate how comprehensive it is. We all aim to enhance the clarity and accuracy of our project documentation.” 2. Express Your Observations Without Accusations: Instead of directly accusing them of using AI, share your observations about the documentation in a way that focuses on the work itself rather than the person. Use "I" statements to express how the documentation affects you or the project. ◦ “I’ve observed some instances in the documentation where the details seem to veer off-topic or contain inaccuracies. I sometimes find it challenging to follow, which might also impact our clients’ or team's understanding.” 3. Suggest a Collaborative Review: Offer to work together to review the documentation or suggest implementing a peer review process. This approach emphasizes teamwork and quality improvement without directly addressing the use of AI. ◦ “Would you be open to collaborating on a review of the documentation? A second pair of eyes can help us catch errors and refine the focus, ensuring our documentation is as clear and accurate as possible.” 4. Introduce the Topic of AI Carefully (if necessary): If you believe it’s crucial to address the potential use of AI, frame it as a broader team or project concern rather than singling out their behavior. ◦ “As we’re all navigating the use of new tools, including AI, it’s important we ensure they’re helping us meet our standards for accuracy and clarity. Let’s discuss how we can best leverage these tools responsibly.” 5. Encourage Open Communication: Make it clear that your goal is to support each other in producing the best possible work. Encourage them to share their thoughts and be open to feedback. ◦ “I value your input and would love to hear your thoughts on how we can continue to improve our documentation process. It’s important to me that we support each other as a team.” Remember, the goal is to foster a supportive environment where feedback is shared constructively and where all team members feel encouraged to strive for improvement together.

😂 15
1
1
souenzzo17:04:02

Be aware:

😁 2
mrnhrd17:04:01

The proper way to ask this depends on various things, including how confident you can be that it was written by an LLM. Is the dev in question competent and do they usually write good documentation? What's their seniority? Do you know them well and know that they are familiar with the codebase in question? Like if you are 99% confident that they did not write this themselves and that they know the codebase well you could go with "It's a reasonable approach to accelerate the writing of documentation by handing the task off to an LLM, but you absolutely have to check what it produced and correct that if necessary. There are multiple things in this doc that are factually incorrect and I know that you know that they are."

respatialized17:04:08

it seems like @U08JKUHA9 is quoting ChatGPT but it’s actually good advice for dealing with a sensitive topic carefully

respatialized17:04:56

a possible way to indirectly confront the issue without even mentioning AI would be to find an example that you specifically found to be unhelpful because it was incorrect and ask your colleague to explain why they wrote that answer for that particular topic.

mrnhrd17:04:24

You should not worry about "accusing" someone of using an LLM, because there is nothing per se wrong with using LLMs. What you should worry about is if they didn't use one you just told them their writing is so bad you thought a computer did it.

Daniel Craig17:04:36

Thanks for all the viewpoints and counsel