Status: New
Owner: ----
Labels: Type-Defect Priority-Medium
New issue 26 by
mark.kat...@gmail.com: fix16_div bug due to __builtin_clzl
http://code.google.com/p/libfixmath/issues/detail?id=26
To reproduce issue:
#include <iostream>
#include "fixmath.h"
std::cout <<
fix16_to_float(
fix16_div(
fix16_from_float(10.0f),
fix16_from_float(1.1f)
)
);
std::cout << std::endl;
Expected versus actual output:
expected: 9.09087
actual: 0
Version/operating system/compiler details:
libfixmath version: r64
operating system: Linux Raspberry 3.5.0-22-generic #34-Ubuntu SMP Tue
Jan 8 21:47:00 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
compiler: gcc version 4.7.2 (Ubuntu/Linaro 4.7.2-2ubuntu1)
compilation flags include: -O0 -g -std=c++0x
Details:
Bug seems to be due to __builtin_clzl, which returns 44 for
fix16_from_int(10), causing all sorts of problems. I guess you may be
falsely assuming this function counts the number of leading zeros of a
32-bit integer, whereas really an int may have more than 32 bits.
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings