[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
static_cast<float>(1.0) versus 1.0f?
From: |
Rik |
Subject: |
static_cast<float>(1.0) versus 1.0f? |
Date: |
Tue, 17 Feb 2015 10:28:21 -0800 |
2/17/15
Octave gets the phase wrong on acosh (-10i) because we took a
simplification for real numbers that isn't appropriate for complex ones.
In re-writing the routine in lo-mappers.cc I now have
FloatComplex
acosh (const FloatComplex& x)
{
return log (x +
sqrt (x + static_cast<float>(1.0)) * sqrt (x - static_cast<float>(1.0)));
}
This would look a whole lot simpler, and more closely resemble the double
version of the function, if we could just use 1.0f for float compile time
constants. Is this acceptable?
FloatComplex
acosh (const FloatComplex& x)
{
return log (x + sqrt (x + 1.0f) * sqrt (x - 1.0f));
}
--Rik
- static_cast<float>(1.0) versus 1.0f?,
Rik <=