3.3099016081e+012
应为3309901608149
1.0553402147e+011
应为0105534021470
3.1004004826e+012
应为3100400482588
答案 0 :(得分:0)
@Provider
public class PrettyFilter implements ContainerResponseFilter {
@Override
public void filter(ContainerRequestContext reqCtx, ContainerResponseContext respCtx) throws IOException {
UriInfo uriInfo = reqCtx.getUriInfo();
//log.info("prettyFilter: "+uriInfo.getPath());
MultivaluedMap<String, String> queryParameters = uriInfo.getQueryParameters();
if(queryParameters.containsKey("pretty")) {
ObjectWriterInjector.set(new IndentingModifier(true));
}
}
public static class IndentingModifier extends ObjectWriterModifier {
private final boolean indent;
public IndentingModifier(boolean indent) {
this.indent = indent;
}
@Override
public ObjectWriter modify(EndpointConfigBase<?> endpointConfigBase, MultivaluedMap<String, Object> multivaluedMap, Object o, ObjectWriter objectWriter, JsonGenerator jsonGenerator) throws IOException {
if(indent) jsonGenerator.useDefaultPrettyPrinter();
return objectWriter;
}
}
}
但是,对于使用大数字,如果你想保持精确度,你应该研究BCMath extension
答案 1 :(得分:0)
有几种方法可以正确显示这些。首先,您可以在php中增加分配给浮动的数字precision
,或者您可以使用sprintf
。
<?php
ini_set('precision',20);
$bigint=33099016081494738093;
echo $bigint;
--> 33099016081494736896;
or
echo sprintf('%020.0f', $bigint);
--> 33099016081494736896;
?>
答案 2 :(得分:0)
这应该给你正确的方向。
chart.getViewPortHandler().setMaximumScaleX(2f);
chart.getViewPortHandler().setMaximumScaleY(2f);
输出为3309901608100,并且还要查看此Floating point precision in PHP