decimal celciusDiv not working and being used as 0 when casted as int
Trying to convert from farenheit to celcius and it just isn't working and I'm not sure why exactly. i can't multiply by a decimal variable it seems so have to cast as int. It then seems to result in celciusDiv becoming 0 instead of 5.0m/9.0m. It's a logic error as well so it won't even tell me why it isn't working.
10 Replies
You're rounding
celciusDiv
to an int
An integer is... an integer
It cannot have any decimal placesDamn I just realised. Yeah I get you. In that case I'm not sure then how I would multiply by a decimal value
Angius
REPL Result: Success
Console Output
Compile: 500.462ms | Execution: 37.185ms | React with ❌ to remove this embed.
Make
fahrenheit
also a decimalYeah I see what you mean, that's my mistake.
And work only with decimals
In general or just with this file?
Well, wherever it makes sense
Temperature, in general, can have decimal values
So it should be represented as such
If you're working with, dunno, warehouse management system, you can't have 1.8291 of a watermelon
So integers make sense
Yeah I get you that was just a silly thing on my part. I need more sleep or something 🤣
Thanks much, though.
Anytime :Ok: