You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
# include <bits/stdc++.h>
using namespace std ;
int main ( ) {
double a , b ;
cin > > a > > b ;
/*
%g用于打印浮点型数据时, 会去掉多余的零, 至多保留六位有效数字( 不同于%e的默认保留小数点后6位)
当%g用于打印超过6位的浮点型数据时, 因为精度问题, %f不得不输出一个不精确的超过六位的数字, %e也是同样,
而%g此时会选择%e格式进行输出, 并且按第一条要求, 去掉多余的零, 并且四舍五入到6位数字。这是《C Primer Plus》中所说的超过精度的时候的情况。 ( 可见, 这个6位, 是按float类型精度来计算的。)
当一个数字的绝对值很小的时候,要表示这个数字所需要的字符数目就会多到让人难以接受。
举例而言,如果我们把π*10^-10写作0.00000000000314159就会显得非常丑陋不雅, 反之, 如果我们写作3.14159e-10, 就不但简洁而且易读好懂。当指数是-4时, 这两种表现形式大小相同。对于比较小的数值, 除非该数的指数小于或者等于-5, %g才会采用科学技术发来表示, 即, 以%e的格式进行输出。
*/
//printf("%g", a - int(a / b) * b);
cout < < a - int ( a / b ) * b < < endl ;
return 0 ;
}