Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Lerp and int/float conversions
#3
C and C++ do "type promotion", that is: automatically convert the resulting type of an expression to the type of the term that requires most precision. For what you have discovered, C# doesn't. Interesting!

The linear interpolation you talked about (with 3 terms) is the simplified one, where the source and target intervals are assumed to start at 0. Yo just need the source value to convert, the source limit and the target limit. But the general formula accepts arbitrary intrevals that don't start at 0. Take  look at this article, and you'll find the formula I use in the samples:
https://en.wikipedia.org/wiki/Linear_interpolation
Reply


Messages In This Thread
Lerp and int/float conversions - by Domarius - 07-18-2018, 10:17 AM
RE: Lerp and int/float conversions - by Domarius - 07-18-2018, 08:30 PM
RE: Lerp and int/float conversions - by megamarc - 07-18-2018, 11:23 PM
RE: Lerp and int/float conversions - by Domarius - 07-19-2018, 08:00 AM
RE: Lerp and int/float conversions - by megamarc - 07-19-2018, 03:58 PM
RE: Lerp and int/float conversions - by Domarius - 07-19-2018, 09:18 PM
RE: Lerp and int/float conversions - by megamarc - 07-24-2018, 02:02 AM
RE: Lerp and int/float conversions - by Domarius - 07-24-2018, 08:34 PM
RE: Lerp and int/float conversions - by megamarc - 08-07-2018, 06:39 AM
RE: Lerp and int/float conversions - by Domarius - 08-08-2018, 06:44 AM
RE: Lerp and int/float conversions - by megamarc - 08-09-2018, 06:30 AM
RE: Lerp and int/float conversions - by Domarius - 08-20-2018, 04:50 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)