math.cxx (a067bd65) | math.cxx (cda7f8b3) |
---|---|
1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 1099 unchanged lines hidden (view full) --- 1108 double fe = exp( fValue ); 1109 if (fe == 1.0) 1110 return fValue; 1111 if (fe-1.0 == -1.0) 1112 return -1.0; 1113 return (fe-1.0) * fValue / log(fe); 1114} 1115 | 1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 1099 unchanged lines hidden (view full) --- 1108 double fe = exp( fValue ); 1109 if (fe == 1.0) 1110 return fValue; 1111 if (fe-1.0 == -1.0) 1112 return -1.0; 1113 return (fe-1.0) * fValue / log(fe); 1114} 1115 |
1116double SAL_CALL rtl_math_powr( double fValue, double fExp ) SAL_THROW_EXTERN_C() 1117{ 1118 if ((fValue == 0.0 && fExp == 0.0) || 1119 (rtl::math::isInf( fExp ) && !rtl::math::isSignBitSet( fExp )) || 1120 (rtl::math::isInf( fValue ) && !rtl::math::isSignBitSet( fValue ))) 1121 { 1122 double fResult; 1123 ::rtl::math::setNan( &fResult ); 1124 return fResult; 1125 } 1126 return pow(fValue, fExp); 1127} |
|
1116 | 1128 |
1129 |
|
1117double SAL_CALL rtl_math_log1p( double fValue ) SAL_THROW_EXTERN_C() 1118{ 1119 // Use volatile because a compiler may be too smart "optimizing" the 1120 // condition such that in certain cases the else path was called even if 1121 // (fp==1.0) was true, where the term (fp-1.0) then resulted in 0.0 and 1122 // hence the entire expression resulted in NaN. 1123 // Happened with g++ 3.4.1 and an input value of 9.87E-18 1124 volatile double fp = 1.0 + fValue; --- 137 unchanged lines hidden --- | 1130double SAL_CALL rtl_math_log1p( double fValue ) SAL_THROW_EXTERN_C() 1131{ 1132 // Use volatile because a compiler may be too smart "optimizing" the 1133 // condition such that in certain cases the else path was called even if 1134 // (fp==1.0) was true, where the term (fp-1.0) then resulted in 0.0 and 1135 // hence the entire expression resulted in NaN. 1136 // Happened with g++ 3.4.1 and an input value of 9.87E-18 1137 volatile double fp = 1.0 + fValue; --- 137 unchanged lines hidden --- |