jcchurch.bsky.social
Hi. I'm http://Dr.Church. Professor of Computer Science, Austin Peay State University. Interested in programming languages and computational geometry. Unitarian Universalist.
http://linktr.ee/drchurch
85 posts
232 followers
245 following
Prolific Poster
Conversation Starter
comment in response to
post
I've also noticed that I'm the first and only person to solve some of these problems using Fortran. I want to bring Fortran back.
comment in response to
post
I must meet Brie. Soon, Brie. Soon.
comment in response to
post
We aren't going to make it, are we?
comment in response to
post
It's really gross how fast Google, Facebook, and Disney capitulated to Trump.
comment in response to
post
We can use this trick to round values without casting them to an integer.
public static double round(double x) {
x = x >= 0 ? x + 0.5 : x - 0.5;
return x - (x % 1.0);
}
comment in response to
post
Using the previous technique to drop values after the decimal works for positive and negative values.
double x = -3.12345;
System.out.println(x);
System.out.println(x % 1);
System.out.println(x - (x % 1)); // -3.0
System.out.println( (int) x ); // -3
comment in response to
post
The modulus operator (%) works for floating-point values and integers. If 'x' is a double type, then...
x - (x % 1)
... will discard everything after the decimal point. This might be preferable to casting a value to an integer and then casting it back to a double.
comment in response to
post
This seems like a problem easily solved by software.
if (message doesn't end with period) {
add period to end of message;
}
comment in response to
post
Okay, that's gross and I don't like it.
comment in response to
post
I thought I had an original idea. Apparently people have been building this deck for a while now.