看板Programming
标 题Re: [问题] pow的问题in C
发信站政大狂狷年少 (Sat Oct 7 01:38:13 2006)
转信站ptt!ctu-reader!ctu-peer!news.nctu!netnews.csie.nctu!news.cs.nthu!WHSHS
※ 引述《[email protected] (一个人的行李)》之铭言:
> printf("%d\t",a[i][j]);
那是因为要改的不只有 int 变成 double,
你 printf 这边的 %d 也要改成 %lf,
不然 double 的 size 是 64-bit,
而你的 int size 可能不是 64-bit,
假设你的 int size 是 32-bit,
那 printf 只会抓到 64-bit 的一半来做显示,
而且是直接把 double 在 memory 里的表示法直接当成整数的表示法解读,
简单说就是不但只拿到一半的 data 连解读方式都是错误的,
这样显示出来当然会有问题。
> 後来把 int a[10][4]; 改成 double a[10][4];後 是没warning了
> 可是最後数字全变成0
> 想请教各位这个warning到底是怎麽一回事?
> 谢谢!!!
--
Name: Tseng, Ling-hua E-mail Address:
[email protected]
School: National Tsing Hua University Department: Computer Science
Interesting: C++, Compiler, PL/PD, OS, VM, Large-scale software design
Researching: Undecided
Homepage:
https://it.muds.net/~uranus
--
╔═══╗ ┼────────────────────────╮
║狂狷 ║ │
* Origin:[ 狂 狷 年 少 ] whshs.cs.nccu.edu.tw ╰─╮
║ 年少║ ┼╮
< IP:140.119.164.252 > ╰─╮
╚╦═╦╝ ╰
* From:61-230-225-167.dynamic.hinet.net
─╨─╨─ KGBBS ─ ◎ 遨翔"BBS"的狂狷不驯;属於年少的轻狂色彩 ◎